Sau khi cập nhật từ Laravel 4,2-5,0, Tôi nhận được thông báo sau trong hầu hết các trang của ứng dụng của tôi:Laravel hành động không được định nghĩa
InvalidArgumentException trong UrlGenerator.php dòng 561: Hành động ArticlesController @ tạo các không xác định.
Trong file routes.php của tôi, tôi có:
Route::get('articles/create', ['as' => 'articles.create', 'uses' => '[email protected]']);
Route::post('articles/create', ['as' => 'articles.create.handle', 'uses' => '[email protected]']);
Và trong bộ điều khiển của tôi:
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('[email protected]')->withInput();
} else if ($input['op']=="post") {
//
}
}
}
Các lỗi tôi nhận được xuất phát từ dòng này:
return redirect()->action('[email protected]')->withInput();
Bất kỳ Cứu giúp? Cảm ơn, Ilias
Vui lòng chạy 'php artisan route: list' và xem liệu route' ArticlesController @ create' có được liệt kê không. – lukasgeiter
return redirect() -> action ('Ứng dụng \ Http \ Controllers \ ArticlesController @ create'); –
Tính năng này có hoạt động nếu bạn đi theo cách thủ công đến 'bài viết/tạo' không? Tôi sẽ đề nghị sử dụng các tuyến đường thay vì hành động 'redirect() -> route ('articles.create');' –