예제 #1
0
 /**
  * Register bindings in the container.
  *
  * @return void
  */
 public function boot(Guard $guard)
 {
     $topics = [];
     if ($guard->check()) {
         $topics = Topic::whereHas('followers', function ($q) use($guard) {
             $q->where('user_id', $guard->user()->id);
         })->get();
     }
     view()->composer('common.notifications', function ($view) use($topics) {
         $view->with('notifications', []);
     });
     view()->composer('posts.index', function ($view) {
         if (Input::get('order') && Input::get('order') == 'popular') {
             $order = 'popular';
         } else {
             $order = 'recent';
         }
         $view->with('order', $order);
     });
     view()->composer('posts.index', function ($view) {
         if (Input::get('view') && Input::get('view') == 'grid') {
             $v = 'grid';
         } else {
             $v = 'list';
         }
         $view->with('view', $v);
     });
 }