public function favorites() { if (!Sentry::check()) { return; } $nodes = PageFavorite::whereUserId(Sentry::getUser()->id)->with('page', 'page.userPreference')->orderBy('order')->get(); return View::make('admin::navigation.favorites', compact('nodes')); }
public static function createDefaultsForUser(UserInterface $user) { $config = Config::get('admin::config.favorites'); $matcher = App::make('Boyhagemann\\Matcher\\Container')->fromArray($config); $matcher->setDefault('user_id', $user->id); foreach (Page::all() as $page) { foreach ($matcher->match($page) as $favorite) { PageFavorite::create($favorite); } } }