/** * Define your route model bindings, pattern filters, etc. * * @param \Illuminate\Routing\Router $router * @return void */ public function boot(Router $router) { // parent::boot($router); $router->bind('article', function ($id) { // don't want to view article that published > current return \Laravel5Fundatmentals\Article::publish()->findOrFail($id); }); //$router->model('article', 'Laravel5Fundatmentals\Article'); }
public function synTags(Article $article, array $tags) { $article->tags()->sync($tags); }
public function compose(View $view) { $view->with('latest', Article::latest()->first()); }