Can you show as a code ...
maybe you need a parameter, check the documentation
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) }}
you need to provide 2 values one for {clients} and one for {note}
so {{ route('admin:note', [$client, $note]) }}
Please or to participate in this conversation.