title: laravel Unable to prepare route ... for serialization. Uses Closure
body: <p>When I clear caches in my Laravel 5.2 project, I see this error message:</p>
  
  <p>[LogicException]
    Unable to prepare route [panel] for serialization. Uses Closure.</p>
  
  <p>I think that it's related with a route </p>
  
  <pre><code>Route::get('/article/{slug}', 'Front@slug');
  </code></pre>
  
  <p>associated with a particular method in my controller:</p>
  
  <pre><code>public function slug($slug) {
      $article = Article::where('slug',$slug)-&gt;first();
  
      $id = $article -&gt;id_article ;
  
      if ( ($article=== null) || (is_null($id)) ) return view('errors/Db');
  
      else return view('detail')-&gt;with(array('article'=&gt; $article,  'title'=&gt;'My title - '.$article-&gt;title)); 
  }`
  </code></pre>
  
  <p>In short, from a master view I pass $slug, that is a shortlink to the article, with $slug , which is unique in the database, I identify the record and then I pass it's contents to the detail view.</p>
  
  <p>I didn't have any problem when I wrote the method, infact it worked like a charm, but after I cleaned caches, I get that error and the links in the master view don't show any shortcode.</p>
  
  <p>Where am I doing wrong?</p>