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



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2k8DpVa
via IFTTT

Aucun commentaire:

Enregistrer un commentaire