jeudi 24 novembre 2016

Route Model Binding working in Laravel 5.3 without changes in RouteServiceProvider.php

I'm following the laravel 5 tutorial, in laracasts, by Jeffrey Way. In a Lesson called Route Model Binding, I have changed the methods edit, update and show parameters to Article $article. And now Route Model Binding is working. But I don't change anything in RouteServiceProvider.php. Does laravel a made implicit binding in my case, only reading the parameter Article $article??? I'm using laravel 5.3.

Before(edit method)

public function edit($id)
    {
      $article = Article::findOrFail($id);
      return view('articles.edit', compact('article'));
    }

After

 public function edit(Article $article)
    {
      return view('articles.edit', compact('article'));
    }

Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire