/** * Bootstrap the application events. * * @return void */ public function boot() { // custom namespace $this->package('alexwenzel/laravel-commentary', 'laravel-commentary'); // comment list composer View::composer('laravel-commentary::comment-list', function ($view) { $entity = $view->entity; $comments = Comment::where('entity', $entity)->where('status', Comment::statusApproved)->orderBy('created_at', 'desc')->get(); $view->with('comments', $comments); }); }