Laravel路线articles.store未定义

时间:2018-10-31 15:30:33

标签: laravel laravel-5.7

我有一个ArticleController,但是未定义store方法。 其他所有方法都显示在route:list中。 我试图删除控制器,并再次使我,但没有区别。 我制作了另一个控制器,并将其命名为TestController,效果很好。 有人可以帮我吗?

资源/视图/create.blade.php

<form method="POST" action="{{ route('articles.store') }}">

app / http / Controllers / ArticleController.php

public function create()
{
    return view('staff.articles.create');
}

public function store(Request $request)
{
  //Some code here
}

routes / web.php

Route::group(['prefix'=>'staff','middleware'=>['role:editor|author']],function()
{
  Route::resource('/articles','ArticleController');
});

php artisan route:list

|        | GET|HEAD  | staff/articles                      | articles.index      | App\Http\Controllers\ArticleController@index                           | web,role:editor|author |
|        | GET|HEAD  | staff/articles/create               | articles.create     | App\Http\Controllers\ArticleController@create                          | web,role:editor|author |
|        | DELETE    | staff/articles/{article}            | articles.destroy    | App\Http\Controllers\ArticleController@destroy                         | web,role:editor|author |
|        | GET|HEAD  | staff/articles/{article}            | articles.show       | App\Http\Controllers\ArticleController@show                            | web,role:editor|author |
|        | PUT|PATCH | staff/articles/{article}            | articles.update     | App\Http\Controllers\ArticleController@update                          | web,role:editor|author |
|        | GET|HEAD  | staff/articles/{article}/edit       | articles.edit       | App\Http\Controllers\ArticleController@edit                            | web,role:editor|author |

0 个答案:

没有答案