Reputation: 183
I am trying to achieve url structure like below.
Error is Missing required parameters for [Route: clients.show_project] [URI: clients/{client}/{project_id}].
Route::group(['prefix' => 'clients', 'as' => 'clients.'], function () {
Route::get('/', [
'uses' => 'ClientsController@index',
'as' => 'index',
]);
Route::get('/create', [
'uses' => 'ClientsController@create',
'as' => 'create',
]);
Route::post('/store', [
'uses' => 'ClientsController@store',
'as' => 'store',
]);
Route::group(['prefix' => '{client}', '__rp' => ['menu' => 'clients']], function () {
Route::get('/', [
'uses' => 'ClientsController@show_client',
'as' => 'show',
]);
});
Route::group(['prefix' => '{client}/{project_id}'], function () {
Route::get('/', [
'uses' => 'ClientsController@show_project',
'as' => 'show_project',
]);
});
});
On view
<a href="{{ route('clients.show_project', $task->client_id, $task->project_id)}}">{{ $task->title }}</a>
Controller
public function show_project($client, $project_id)
{
$project_threads = Project_Threads::where('project_id', $project_id)->get();
return $project_threads;
}
Upvotes: 1
Views: 309
Reputation: 2044
The problem is in your view. Your have to pass params in an array in route()
. Try this:
<a href="{{ route('clients.show_project', [$task->client_id, $task->project_id])}}">{{ $task->title }}</a>
Upvotes: 1