febronia's avatar

Missing required parameters for (route)

I've run into a bit of an issue in my routing so if someone could please point out what I'm missing it would be greatly appreciated. Apologies in advance but I prefer a more verbose way of making routes instead of just using resource.

Route::group(['as' => 'admin:', 'prefix' => 'admin', 'namespace' => 'Admin', 'middleware' => ['auth']], function () {

Route::group(['prefix' => '/persoonlijk-aanbod/{clients}/notes'], function() {
    Route::get('/create', 'NoteController@create');
    Route::post('/', 'NoteController@store')->name('notes');
    Route::get('/{note}/edit', 'NoteController@edit')->name('note');
    Route::put('/{note}', 'NoteController@update');
});

notecontroller public function create($client) { return view('admin.notes.create', compact('client')); }

public function store($client, Request $request)
{
    $inputs = Helpers::nullInputs($request->all());
    $note = Note::create($inputs);

    $collega = User::findOrFail($request->get('collega'));
    $note->collega()->associate($collega);

    if ($request->has('client')) {
        $client = Client::findOrFail($client);
        $note->client()->associate($client);
    }

    $note->save();

    flash()->success('De notitie is succesvol toegevoegd.');

    return response()->json(['result' => true, 'redirect' => route('admin:client', $client) . '?tab=notities']);
}


public function edit($client)
{
    return view('admin.notes.edit', compact('client'));
}

index.blade

data-link="{{ route('admin:note', $client) }}

0 likes
3 replies
StefanoRuth's avatar
Level 7

you need to provide 2 values one for {clients} and one for {note}

so {{ route('admin:note', [$client, $note]) }}

febronia's avatar

Thanks StefanoRuth, that works for me! :)

Please or to participate in this conversation.