After updating from Laravel 4.2 to 5.0, I am getting the following message in almost every page of my application:
InvalidArgumentException in UrlGenerator.php line 561: Action ArticlesController@create not defined.
In my routes.php file I have:
Route::get('articles/create', ['as' => 'articles.create', 'uses' => 'ArticlesController@create']);
Route::post('articles/create', ['as' => 'articles.create.handle', 'uses' => 'ArticlesController@handleCreate']);
And in my controller:
class ArticlesController extends Controller {
public function create()
{
$input=null;
if (Input::old()) {
$input = Input::old();
}
$tagsJson = Tag::all()->toJson();
$categories = ArticleCategory::all();
return View::make('admin.articles.create', compact(array('tagsJson', 'categories', 'input')));
}
public function handleCreate()
{
$input = Input::all();
if ($input['op']=="preview") {
return redirect()->action('ArticlesController@create')->withInput();
} else if ($input['op']=="post") {
//
}
}
}
The error I get comes from this line:
return redirect()->action('ArticlesController@create')->withInput();
Any help?
Thanks, Ilias
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…