lundi 4 avril 2016

Create with arguments [Laravel 5.2]

I want to use a argument in a create action, but when I try to access the action:

Missing argument 1 for App\Http\Controllers\AdsDiagController::create()

Here is the create action:

public function create($id){
    $record = TestRecord::findOrFail($id);
    return view("adsdiag.create", ["record" => $record]);
}

Here is the link to the action:

<a href="{!! action('AdsDiagController@create', $record->id ) !!}">Create</a>

And the route:

Route::resource('adsdiag', 'AdsDiagController');

I'm newbie in laravel, and I'm really confused with routes. I appreciate any help.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire