samedi 30 septembre 2017

How does Laravel Contracts work

When I want to destroy a record,I only use the code like below

route

Route::resource('link-submit', 'LinkSubmitController', ['except' => ['show']]);

action

public function destroy(LinkSubmit $linkSubmit)
{
    if ($linkSubmit->delete()) {
        $key = 'ok_message';
        $message = 'delete ok';
    } else {
        $key = 'error_message';
        $message = 'delete fail';
    }

    return redirect()->back()->with($key, $message);
}

I found that when I use $link instead of $linkSubmit,it will not work. How Laravel get the parameters? Which file is the code in , I'm confused



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire