public function __construct() { //$this->beforeFilter(function(){ }); $this->uriSegment = null; $this->modelName = null; $this->viewsPath = null; $this->resourceId = null; if (Route::input('alias') !== null) { $this->uriSegment = Route::input('alias'); $this->viewsPath = File::exists(app_path('views/' . Config::get('reactiveadmin::uri') . '/' . $this->uriSegment)) ? Config::get('reactiveadmin::uri') . '.' . $this->uriSegment : 'reactiveadmin::default'; $this->modelName = studly_case(str_singular(Route::input('alias'))); $this->modelWrapper = App::make('model_wrapper'); $this->modelWrapper->model($this->modelName); if (Route::input('id') !== null) { $this->resourceId = Route::input('id'); } View::share('config', $this->modelWrapper->getConfig()); // TODO: refactor this! // custom behavior switch ($this->uriSegment) { case 'settings': View::composer(array('admin.' . $this->viewsPath . '.index'), function ($view) { $view->with('settings', Settings::all()); }); break; default: # code... break; } } View::share('view', $this->uriSegment); View::share('model', $this->modelName); }
function __construct() { // share current route in all views View::share('current_url', Route::current()->getPath()); // share current logged in user details all views View::share('current_user', $this->current_user()); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @return mixed */ public function handle(Request $request, Closure $next) { $uri = $request->route()->getParameter('location'); $page = Page::findByUri($uri); if (!$page) { $url = URL::findByLocation($uri); // The URL isn't in use or // The URL is in use and has a page - the page must not be visible to the current user // // 404. if (!$url || !$url->getPage()->isVisible()) { throw new NotFoundHttpException(); } // The url is in use but doesn't have a page. // The page must have been deleted. // // 410. throw new GoneHttpException(); } if (Editor::isDisabled() && !$page->isVisible()) { throw new NotFoundHttpException(); } if (!$page->url()->is($uri)) { return redirect((string) $page->url(), 301); } $request->route()->setParameter('page', $page); Editor::setActivePage($page); View::share('page', $page); return $next($request); }
public function __construct() { // $this->middleware('auth'); // Fetch the Site Settings object $this->currentModelName = Lang::get('crud.shiaiCategory'); View::share('currentModelName', $this->currentModelName); }
public function __construct() { $this->middleware('auth'); // Fetch the Site Settings object $this->currentModelName = Lang::get('crud.competitor'); View::share('currentModelName', $this->currentModelName); }
/** * Setup the layout used by the controller. * * @return void */ protected function setupLayout() { $this->layout = View::make(Config::get('syntara::views.master')); $this->layout->title = 'VietSol CMS'; $this->layout->breadcrumb = array(); View::share('siteName', 'VietSol CMS'); }
public function process() { $this->runSteps(); View::share('steps', $this->getSteps()); View::share('currentStage', $this); return View::make(INSTALLER_NAMESPACE . '::stage')->render(); }
public function __construct() { if (Auth::check()) { $groups = Auth::user()->groups(); $menu = []; if (in_array('Administrator', $groups)) { $menu[] = ['text' => 'Sales', 'url' => '/sales']; $menu[] = ['text' => 'Create Sale', 'url' => '/sales/create']; $menu[] = ['text' => 'Admin', 'url' => '/admin']; } else { if (in_array('Agent', $groups)) { $menu[] = ['text' => 'Create Sale', 'url' => '/sales/create']; } else { if (in_array('QC', $groups)) { $menu[] = ['text' => 'Sales', 'url' => '/sales']; } } } $userRepo = new UserRepo(); $e = $userRepo->findEmployee(Auth::user()->id); if ($e) { $this->employeeId = $e->id; } View::share('myData', $e); View::share('menu', $menu); $id = Input::get('id'); if ($id) { $this->userId = $id; } else { $this->userId = Auth::user()->id; } } }
/** * @param Request $request * @param Closure $next */ public function handle($request, Closure $next) { Lang::setFallback(self::getDefault()); $setLocale = Session::get('setLocale'); //flash data if (Config::get('app.locale_use_cookie')) { if ($setLocale) { Session::set('locale', $setLocale); } if (Session::has('locale')) { App::setLocale(Session::get('locale')); } else { self::autoDetect(); } } else { if (Config::get('app.locale_use_url')) { if ($setLocale) { self::setLocaleURLSegment($setLocale); } else { $lang = self::getLocaleFromURL(); if ($lang) { App::setLocale($lang); } else { if ($request->segment(1) != 'locale') { //ignore set-locale URL self::autoDetect(); self::setLocaleURLSegment(self::get()); } } } } } View::share('lang', self::get()); }
/** * Displays the CMS interface with buttons for add page, settings, etc. * Called from an iframe when logged into the CMS. * The ID of the page which is being viewed is given as a URL paramater (e.g. /boomscms/editor/toolbar/<page ID>). */ public function getToolbar() { $page = Page::find($this->request->input('page_id')); $toolbarFilename = $this->editor->isEnabled() ? 'toolbar' : 'toolbar_preview'; View::share(['page' => $page, 'editor' => $this->editor, 'auth' => auth(), 'person' => auth()->user()]); return view("boomcms::editor.{$toolbarFilename}"); }
/** * Creates a new DashScheduleController instance. * * @return \CachetHQ\Cachet\Http\Controllers\DashScheduleController */ public function __construct() { // TODO: Remove this from DashIncidentController, so it's shared? $this->subMenu = ['incidents' => ['title' => trans('dashboard.incidents.incidents'), 'url' => route('dashboard.incidents.index'), 'icon' => 'ion-android-checkmark-circle', 'active' => false], 'schedule' => ['title' => trans('dashboard.schedule.schedule'), 'url' => route('dashboard.schedule.index'), 'icon' => 'ion-android-calendar', 'active' => true]]; View::share('sub_menu', $this->subMenu); View::share('sub_title', trans('dashboard.incidents.title')); }
public function __construct() { $this->beforeFilter('csrf', array('on' => 'post')); // This should be moved. Think about a nice location View::share('playersMini', app('Metin2CMS\\Services\\HighscoreService')->players()); View::share('guildsMini', app('Metin2CMS\\Services\\HighscoreService')->guilds()); }
public function index() { View::share(['title' => 'Permission', 'sideBar' => NavigatorHelper::getSideBarBE()]); $user = Session::get('user'); $userRole = $user['role_id']; $role = Role::where('id', '!=', 1)->where('id', '!=', $userRole)->get(['id', 'name'])->toArray(); return view('permission.list')->with(['role' => $role]); }
public function create() { View::share(['title' => Lang::get('content.create account'), 'sideBar' => NavigatorHelper::getSideBarBE()]); $model = new Role(); //Not display SA $role = $model->where('id', '!=', 1)->get(); return view('account.create', compact('role', $role)); }
public function index() { View::share(['title' => 'Product management', 'sideBar' => NavigatorHelper::getSideBarBE()]); $type = Type::all(['id', 'name'])->toArray(); $format = Format_cd::all(['id', 'name'])->toArray(); $price_groups = Price_group::all(['id', 'name', 'root_price', 'price'])->toArray(); return view('catalog.product.list')->with(['type' => $type, 'format' => $format, 'price_groups' => $price_groups]); }
function __construct(ClientRepo $clientRepo, SellerRepo $sellerRepo) { $this->middleware('auth'); $this->clientRepo = $clientRepo; $this->sellerRepo = $sellerRepo; $properties = $this->groupedSelect(); View::share('properties', $properties); }
public function __construct() { $this->middleware('auth'); if (Auth::user()) { $this->user = Auth::user(); } View::share('authUser', $this->user); }
/** * Setup the testing environment. */ public function setUp() { parent::setUp(); // Share view errors to prevent undefined variable in views View::share('errors', Session::get('errors', new \Illuminate\Support\MessageBag())); $this->artisan('migrate', ['--database' => 'testbench', '--path' => '../vendor/cartalyst/sentry/src/migrations']); $this->artisan('migrate', ['--database' => 'testbench', '--path' => __DIR__ . '/Migrations']); }
public function __construct() { //初始化缓存 //Event::fire('cache.init'); //获取配置 $this->initConfig(); View::share('setting', Cache::get('setting')); }
/** * Register any other events for your application. * * @param \Illuminate\Contracts\Events\Dispatcher $events * @return void */ public function boot(DispatcherContract $events) { //get the current view name and set a var with its value view()->composer('*', function ($view) { $view_name = str_replace('.', '-', $view->getName()); View::share('view_name', $view_name); }); parent::boot($events); }
/** * Bootstrap any application services. * * @return void */ public function boot() { $favicon = Settings::getSettings()['favicon']; $logo = Settings::getSettings()['logo']; $parent_categories = Category::getCategoriesByPublish(1, 0, 1); View::share('favicon', $favicon); View::share('logo', $logo); View::share('parent_categories', $parent_categories); }
/** * @param $page */ private function setViewVariables($page) { View::share('page', $page); View::share('title', $page->content->title); //only allow page edit in a page with a page_id View::share('allow_edit_page', $page->id ? true : false); //Breadcrumbs View::share('breadcrumbs', \Cms\Models\Page::subPages($page->id)); }
public function __construct() { $models = Config::get('dashboard::models'); if (Auth::pep__dashboard()->check()) { $user = Auth::pep__dashboard()->user(); $models = array_intersect_key($models, array_flip($user->rights)); } View::share('models', $models); }
public function __construct() { //Create nav $this->nav = array(Lang::get('cms::m.site-settings') => route('settings'), Lang::get('cms::m.manage-users') => route('users'), 'Unsorted pages' => route('unsortedPages')); View::share("nav", $this->nav); View::share("title", false); //set default zero / false value for title //\Auth::loginUsingId(1); }
/** * Displays the CMS interface with buttons for add page, settings, etc. * Called from an iframe when logged into the CMS. * The ID of the page which is being viewed is given as a URL paramater (e.g. /cms/editor/toolbar/<page ID>). */ public function getToolbar() { $page = Page::find($this->request->input('page_id')); $this->editor->setActivePage($page); View::share('page', $page); View::share('editor', $this->editor); $toolbarFilename = $this->editor->isEnabled() ? 'toolbar' : 'toolbar_preview'; return view("boomcms::editor.{$toolbarFilename}"); }
/** * Displays the CMS interface with buttons for add page, settings, etc. * Called from an iframe when logged into the CMS. */ public function getToolbar(EditorObject $editor, Request $request) { $page = PageFacade::find($request->input('page_id')); View::share(['page' => $page, 'editor' => $editor, 'auth' => auth(), 'person' => auth()->user()]); if ($editor->isHistory()) { return view('boomcms::editor.toolbar.history', ['previous' => $page->getCurrentVersion()->getPrevious(), 'next' => $page->getCurrentVersion()->getNext(), 'version' => $page->getCurrentVersion(), 'diff' => new Diff()]); } $toolbarFilename = $editor->isEnabled() ? 'edit' : 'preview'; return view("boomcms::editor.toolbar.{$toolbarFilename}"); }
public function __construct(Auth $auth) { $this->auth = $auth; if ($auth::guest()) { return redirect('auth.login'); } $this->currentUser = $auth::user(); View::share('currentUser', $this->currentUser); View::share('eUnreadCount', $this->currentUser->emailsTo()->unread()->count()); }
public function __construct(Currency $currencyModel, Note $noteModel) { $notes = $noteModel->getLastNote(); if (count($notes) < 1) { $notes = false; } //GLOBAL SETTINGS $this->_glob = array('_note' => $notes, '_curr' => $currencyModel->getRate(), '_baseCurrency' => 'RUB', '_precision' => 2, '_countProductsOfPage' => Auth::User() ? Auth::User()->count_products : 100, '_maxCountProductsOfPage' => 500, '_alerts' => AbsentController::shortView()); View::share('_glob', $this->_glob); }
/** * Execute an action on the controller. * * @param string $method * @param array $parameters * @return \Symfony\Component\HttpFoundation\Response */ public function callAction($method, $parameters) { $user = Auth::user(); $notification = app('Smile\\Repositories\\NotificationContract'); View::share('unread', $notification->countUnOpened($user)); View::share('notifications', $notification->search($user)); View::share('categories', app('Smile\\Repositories\\CategoryContract')->allActive()); View::share('featured', app('Smile\\Services\\PostService')->featured(10, $user)); return parent::callAction($method, $parameters); }
public function __construct() { $this->middleware('auth'); if (Auth::user()) { $this->user = Auth::user(); $this->datosempresa = User::find(Auth::user()->id)->empresa; View::share(['user' => $this->user]); View::share(['datosempresa' => $this->datosempresa]); } }