Answer the question
In order to leave comments, you need to log in
Why does laravel give me the error Missing required parameters for [Route: admin.articles.edit]?
Good day. I have routes:
Route::prefix('admin')->middleware('auth')->group(function() {
//admin
Route::get('/',['uses' => 'Admin\[email protected]','as' => 'adminIndex']);
Route::resource('/articles','Admin\ArticlesController');
});
@foreach($articles as $article)
<tr>
<td class="align-left">{{$article->id}}</td>
<td class="align-left">{!! Html::link(route('admin.articles.edit',['articles'=>$article->alias]),$article->title) !!}</td>
<td class="align-left">{{Str::limit($article->text,200)}}</td>
<td>
@if(isset($article->img->mini))
{!! Html::image(asset(env('THEME')).'/images/articles/'.$article->img->mini) !!}
@endif
</td>
Route::name('admin.')->prefix('admin')->middleware('auth')->group(function() {
Route::get('/articles/edit/{articles?}',['uses'=>'Admin\[email protected]','as'=>'admin.articles.edit']);
Answer the question
In order to leave comments, you need to log in
The prefix in the route group does not affect the name of the routes. name is only affected by name. The route should be like this
Without any obscure links and constructions. In the controller, already get the necessary properties of the $article->tilte type. And you shouldn't call Env directly. This is done in configs based on existing Laravel examples.
route('articles.edit', $article)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question