当我清除Laravel 5.2项目中的缓存时,我看到以下错误消息:
[LogicException] Unable to prepare route [panel] for serialization. Uses Closure.
我认为这与路由有关
Route::get('/article/{slug}', 'Front@slug');
与我的控制器中的特定方法关联:
public function slug($slug) {
$article = Article::where('slug',$slug)->first();
$id = $article ->id_article ;
if ( ($article=== null) || (is_null($id)) ) return view('errors/Db');
else return view('detail')->with(array('article'=> $article, 'title'=>'My title - '.$article->title));
}`
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.
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.
我哪里做错了?