public function postUser() { $datosLogin = (array) Input::get('datosLogin'); $rules = array('username' => 'required', 'password' => 'required|min:6'); $validator = Validator::make($datosLogin, $rules); if ($validator->fails()) { return Redirect::back()->with('modal-id', 'formModal')->with('error_login_validation', $validator->messages())->with('alert-class', 'alert-danger'); } else { $data = array('username' => $datosLogin['username'], 'password' => $datosLogin['password']); if (Auth::attempt($data, Input::get('remember_token', 0))) { if (Auth::check() && Auth::user()->estadoUsuario == 1) { return Redirect::back()->with(compact(Auth::user()->with('personas.direcciones', 'tipousuarios')->get()))->with('mensajes', 'Bienvenid@ de vuelta:'); View::composer('vistas.user.profile', 'vistas.libro.show', 'templates.template', function ($view) { $view->with(compact(Auth::user()->with('personas.direcciones', 'tipousuarios')->get())); }); } else { Session::flush(); Cookie::forget('laravel_session'); Auth::logout(); return Redirect::to('/')->with('modal-id', 'formModal')->with('error_login', 'nombre de usuario, correo y/o contraseña no son los correctos')->with('alert-class', 'alert-danger'); } } Session::flush(); Cookie::forget('laravel_session'); Auth::logout(); return Redirect::to('/')->with('modal-id', 'formModal')->with('error_login', 'nombre de usuario, correo y/o contraseña no son los correctos')->with('alert-class', 'alert-danger'); } }
/** * Bootstrap the application services. * * @return void */ public function boot() { // \View::composer('*', function ($view) { $view->with('user', \Auth::user()); }); }
private function composePaket() { \View::composer(['frontend.app'], function ($view) { $pakets = Paket::all(); $view->with(['pakets' => $pakets]); }); }
private function _dbSyntax($record_type, $from, $to) { $r_tas = $this->tableName[$record_type]; if ($record_type === 'sales') { $dbResult = $r_tas['table']::with(['salelogs' => function ($sl) { $sl->with(['product' => function ($q) { $q->with(array('categories' => function ($qr) { $qr->select('id', 'type'); }))->select('id', 'name', 'productcat_id'); }, 'customer' => function ($q) { $q->select('id', 'name'); }]); }])->whereBetween($r_tas['field'], array($from, $to))->orderBy('created_at', 'desc'); $m = $dbResult; $totalAmount = $m->sum('amount_tendered'); View::composer('admin.records.records_sales', function ($view) use($totalAmount) { $view->with('sumAmountTendered', $totalAmount); //$view->with('sumAmountDue', $m->sum('salelogs.total_unitprice')); }); //tt( $m->sum('amount_tendered') ); return $m->paginate($r_tas['paginate']); } else { return $r_tas['table']::whereBetween($r_tas['field'], array($from, $to))->get()->toArray(); } }
public function boot() { \View::composer('*', function ($view) { $guest = \App\User::find(0); $view->with('logged_in_user', \Auth::check() ? \Auth::user() : $guest); }); }
/** * Bootstrap the application services. * * @return void */ public function boot() { \View::composer('*', function ($view) { $allCourses = \App\Course::with('requirements')->orderBy('course_name', 'ASC')->get()->toArray(); $view->with('user', \Auth::user())->with('allCourses', $allCourses); }); }
public function __construct() { parent::__construct(); \View::composer('*', function ($view) { $view->with('angular_template_base_path', '/angular/templates?tmp='); }); }
/** * Bootstrap the application services. * * @return void */ public function boot() { # Make the variable "user" available to all views \View::composer('*', function ($view) { $view->with('user', \Auth::user()); }); }
/** * Bootstrap the application services. * * @return void */ public function boot() { // what needs to happen in the service Providers // make user available in all views \View::composer('*', function ($view) { $view->with('user', \Auth::user()); }); }
public function testLogin() { $this->call('GET', 'auth/login'); $this->assertResponseOk(); \View::composer('auth.login', function ($view) { $this->assertArrayHasKey('login_url', $view->getData()); }); }
/** * Bootstrap any application services. * * @param \Illuminate\Bus\Dispatcher $dispatcher */ public function boot(Dispatcher $dispatcher) { // Add export form to project sidebar \View::composer('layouts/sidebar/project', function (View $view) { $exportForm = new ExportIssues(); $exportForm->setup(['project' => $view->project]); $view->with('exportForm', $exportForm); }); }
/** * Bootstrap the application services. * * @return void */ public function boot() { # Make the variable "user" available to all views \View::composer('*', function ($view) { $view->with('user', \Auth::user()); }); view()->composer('home', 'teambernieny\\Http\\ViewComposers\\HomeComposer'); view()->composer('adminhome', 'teambernieny\\Http\\ViewComposers\\AdminHomeComposer'); }
public function __construct() { if (Request::ajax()) { $this->layout = 'backend.ajax_layout'; } View::composer('backend.estructuras.layout', function ($view) { $data['encabezados'] = EstructuraEncabezado::with('categoria')->get(); $view->nest('sidebar', 'backend.estructuras.list', $data); }); }
public function __construct() { if (Request::ajax()) { $this->layout = 'backend.ajax_layout'; View::share('fullmodal', Input::get('fullmodal', false)); } View::composer('backend.instituciones.layout', function ($view) { $data['instituciones'] = Instituciones::maestras(); $view->nest('sidebar', 'backend.instituciones.list', $data); }); }
public function __construct(CustomFields $customFieldsMangaer) { $this->customFieldsMangaer = $customFieldsMangaer; if (Request::ajax()) { $this->layout = 'backend.ajax_layout'; } View::composer('backend.camposextra.layout', function ($view) { $data['camposextra'] = CustomField::all(); $view->nest('sidebar', 'backend.camposextra.list', $data); }); }
/** * Get Latest Posts For Events, Category * Sidebar Widgets */ public function initSidebarPosts() { View::composer('site.events._latest', function ($view) { $latest_event_posts = App::make('EventModel')->latest(4); $view->with(array('latest_event_posts' => $latest_event_posts)); }); View::composer('site.blog._latest', function ($view) { $latest_blog_posts = App::make('Blog')->latest(4); $view->with(array('latest_blog_posts' => $latest_blog_posts)); }); }
/** * Initialize * @return void */ public function __construct() { parent::__construct(); // Instantiate the resource model $this->model = App::make($this->model); // View synthesizer $resource = $this->resource; $resourceName = $this->resourceName; View::composer(array($this->resourceView . '.index', $this->resourceView . '.create', $this->resourceView . '.edit'), function ($view) use($resource, $resourceName) { $view->with(compact('resource', 'resourceName')); }); }
/** * 初始化 * @return void */ public function __construct() { parent::__construct(); // 实例化资源模型 $this->model = App::make($this->model); // 视图合成器 $resource = $this->resource; $resourceName = $this->resourceName; View::composer(array($this->resourceView . '.index', $this->resourceView . '.create', $this->resourceView . '.edit'), function ($view) use($resource, $resourceName) { $view->with(compact('resource', 'resourceName')); }); }
/** * Bootstrap any application services. * * @return void */ public function boot() { if (config('app.debug')) { \DB::enableQueryLog(); } \View::composer('widgets.categories', function ($view) { $view->with('categories', \App\Category::ordered()->get()); }); \View::composer(['widgets.categories', 'articles.index'], function ($view) { $view->with('QUERY', \Request::query()); }); }
/** * Setup the layout used by the controller. * * @return void */ protected function setupLayout() { if (!is_null($this->layout)) { $this->layout = View::make($this->layout); } View::composer('backend.layout', function ($view) { if (array_key_exists('content', $view->getData())) { $view->content->nest('messages', 'backend.messages'); } else { $view->nest('messages', 'backend.messages'); } }); }
/** * Bootstrap the application services. * * @return void */ public function boot() { date_default_timezone_set('america/new_york'); # Make the variable "user" available to all views \View::composer('*', function ($view) { $user = \Auth::user(); $access = false; if (!is_null($user)) { $access = str_contains($user->user_role, 'admin'); } $view->with('user', $user)->with('access', $access); }); }
protected function loadBaseComposer() { $this->loadCrudSubtitle(); $that = $this; // Menu \View::composer('admin::layout.base', function (View $view) use($that) { $view->with('title', $that->title); $view->with('subtitle', $that->subtitle); $view->with('controller', $that); }); view()->composer('admin::layout.base', 'Hpolthof\\Admin\\MenuComposer'); // Navbar \View::composer('admin::layout.partials.navbar.navbar', function (View $view) use($that) { $view->with('controller', $that); }); view()->composer('admin::layout.partials.navbar.navbar', 'Hpolthof\\Admin\\NavbarComposer'); }
/** * Perform post-registration booting of services. * * @return void */ public function boot() { //Views $this->loadViewsFrom(__DIR__ . '/../resources/views', 'admin'); $this->publishes([__DIR__ . '/../resources/assets' => public_path('packages/alexusmai/admin'), __DIR__ . '/../resources/views/elfinder' => base_path('resources/views/vendor/elfinder'), __DIR__ . '/../config/admin.php' => config_path('admin.php'), __DIR__ . '/../config/elfinder.php' => config_path('elfinder.php'), __DIR__ . '/../config/oauth.php' => config_path('oauth.php'), __DIR__ . '/../config/purifier.php' => config_path('purifier.php'), base_path('vendor/alexusmai/yandex-metrika/config/yandex-metrika.php') => config_path('yandex-metrika.php'), base_path('vendor/spatie/laravel-backup/src/config/laravel-backup.php') => config_path('laravel-backup.php')], 'admin'); $this->registerCommands(); //Composers \View::composer('admin::admin.modules.menu', 'Alexusmai\\Admin\\Composers\\AdminMenuComposer'); \View::composer('admin::admin.modules.feedback', 'Alexusmai\\Admin\\Composers\\AdminFeedbackComposer'); \View::composer('admin::admin.modules.user', 'Alexusmai\\Admin\\Composers\\AdminUserComposer'); //Middleware $this->app['router']->middleware('access', 'Alexusmai\\Admin\\Middleware\\AccessLevel'); //Routes pattern $this->app['router']->pattern('id', '[0-9]+'); //Routes include __DIR__ . '/routes.php'; }
/** * Bootstrap any application services. * * @return void */ public function boot() { \View::composer('frontend.partials.sidebar', function ($view) { /** @var \Illuminate\View\View $view */ Menu::make('sidebar', function ($menu) { /** @var \Lavary\Menu\Builder $menu */ /** @var \Illuminate\Database\Eloquent\Collection $tree */ $tree = Category::orderBy('name', 'asc')->published()->get()->toHierarchy(); $tree->each(function (Category $category) use($menu) { /** @var \Lavary\Menu\Item $item */ $item = $menu->add($category->name, ['route' => ['category.show', $category->slug]]); if ($category->children->count() !== 0) { $category->children->each(function (Category $category) use($item) { $item->add($category->name, ['route' => ['category.show', $category->slug]]); }); } }); }); }); }
/** * Bootstrap the application services. * * @return void */ public function boot() { \View::composer('includes.header', function ($view) { $pages = array('AboutUs' => array('route' => 'about-us', 'name' => 'About Us'), 'WhatsOn' => array('route' => 'whats-on', 'name' => 'What\'s On'), 'FindUs' => array('route' => 'find-us', 'name' => 'Find Us'), 'ContactUs' => array('route' => 'contact-us', 'name' => 'Contact Us'), 'Sermons' => array('route' => 'sermons', 'name' => 'Sermons'), 'Members' => array('route' => 'members', 'name' => 'Members')); $view->with('pages', $pages); }); \View::composer('includes.footer', function ($view) { //get the latest sermons $morning = \Crockenhill\Sermon::where('service', 'morning')->orderBy('date', 'desc')->first(); $evening = \Crockenhill\Sermon::where('service', 'evening')->orderBy('date', 'desc')->first(); // and create the view composer $view->with('morning', $morning); $view->with('evening', $evening); }); \View::composer('layouts.members', function ($view) { $area = 'members'; $links = \Crockenhill\Page::where('area', $area)->orderBy(\DB::raw('RAND()'))->take(5)->get(); $view->with('links', $links); }); \View::composer('page', function ($view) { if (\Request::segment(2)) { $slug = \Request::segment(2); $area = \Request::segment(1); } else { $slug = \Request::segment(1); $area = \Request::segment(1); } $headingpicture = '/images/headings/large/' . $slug . '.jpg'; if ($area != 'whats-on') { $links = \Crockenhill\Page::where('area', $area)->where('slug', '!=', $slug)->where('slug', '!=', $area)->take(5)->get(); } else { $links = \Crockenhill\Meeting::where('slug', '!=', $slug)->get(); } $view->with('headingpicture', $headingpicture); $view->with('links', $links); }); }
<?php /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ //Allow the view name to be used within the template View::composer('*', function ($view) { View::share('view_name', $view->getName()); }); //Home route Route::get('/', function () { return view('welcome'); }); //Initial import of the fixtures Route::get('/importfixtures', 'FixtureController@importDB'); //Logged in, dashboard Route::get('/home', 'FixtureController@show'); //Previous fixtures listing Route::get('/previous', 'FixtureController@previous'); //Current fixtures Route::get('/current', 'FixtureController@current'); Route::post('/current', 'FixtureController@submitPredictions'); Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
<?php /* |-------------------------------------------------------------------------- | View Composers |-------------------------------------------------------------------------- */ View::composer('lanager-core::layouts.default.info', function ($view) { $infoPagesMenuItems = Zeropingheroes\LanagerCore\Models\InfoPage::whereNull('parent_id')->get(); $view->with('infoPages', $infoPagesMenuItems); }); View::composer('lanager-core::layouts.default.nav', function ($view) { // Steam OpenID Login URL - cached for 1 day due to request time $authUrl = Cache::remember('authUrl', 60 * 24, function () { $openId = new LightOpenID(Request::server('HTTP_HOST')); $openId->identity = 'http://steamcommunity.com/openid'; $openId->returnUrl = URL::route('user.openIdLogin'); return $openId->authUrl(); }); $view->with('authUrl', $authUrl); });
<?php View::composer('admin-idea-load', function ($view) { $view->nest('calltoaction', 'calltoaction-basic', array('title' => '<i class="icon-lightbulb icon-large"></i> Got An Idea?', 'description' => 'Sweet, let\'s Hear It', 'calltoaction_class' => 'media-calltoaction-basic--lion')); }); View::composer('admin-id-load', function ($view) { $view->nest('calltoaction', 'calltoaction-basic', array('title' => '<i class="icon-flag icon-large"></i> Know a Specific Product?', 'description' => 'Sweet, what\'s the ID?', 'calltoaction_class' => 'media-calltoaction-basic--lion')); }); View::composer('admin-load-products', function ($view) { $view->nest('calltoaction', 'calltoaction-basic', array('title' => '<i class="icon-gears icon-large"></i> Let\'s Load These Products', 'description' => 'Get Er Done.', 'calltoaction_class' => 'media-calltoaction-basic--lion')); }); View::composer('admin-update-product-categorization', function ($view) { $view->nest('calltoaction', 'calltoaction-basic', array('title' => '<i class="icon-wrench icon-large"></i> Update This Product', 'description' => 'Please.', 'calltoaction_class' => 'media-calltoaction-basic--lion')); }); View::composer('gift-assistant', function ($view) { $view->nest('calltoaction', 'calltoaction-basic', array('title' => '<i class="icon-search icon-large"></i> Find Something Perfect', 'description' => "And Make Someone's Day", 'calltoaction_class' => 'media-calltoaction-basic--gift')); }); View::composer('finder-me', function ($view) { $view->nest('calltoaction', 'calltoaction-basic', array('title' => '<i class="icon-heart-empty icon-large"></i> Spoil Yourself', 'description' => "Find Something You Never Knew You Wanted", 'calltoaction_class' => 'media-calltoaction-basic--lion')); }); View::composer('categories', function ($view) { $view->nest('calltoaction', 'calltoaction-basic', array('title' => '<i class="icon-th-large icon-large"></i> Categories', 'description' => '<a href="#occasions" class="calltoaction-basic__jumbotron__link"><i class="icon-tags"></i> Occasions</a><a href="#genders" class="calltoaction-basic__jumbotron__link"><i class="icon-user"></i> Gender</a><a href="#interests" class="calltoaction-basic__jumbotron__link"><i class="icon-star"></i> Interests</a>', 'calltoaction_class' => 'media-calltoaction-basic--categories')); }); View::composer('add', function ($view) { $view->nest('calltoaction', 'calltoaction-basic', array('title' => '<i class="icon-plus-sign-alt icon-large"></i> Add Gifts', 'description' => 'Contribute, Help Others, Get Promoted', 'calltoaction_class' => 'media-calltoaction-basic--add')); });
<?php /** * PongoCMS Interface Composer */ View::composer('cms::templates.default', function ($view) { $view->title = 'PongoCMS'; });
<?php View::composer(array('*view_post'), function ($view) { $viewdata = $view->getData(); if (!Auth::check()) { return $view->nest('commentForm', 'default/site/blog/comment_auth'); } if (!$viewdata['canComment']) { return $view->nest('commentForm', 'default/site/blog/comment_perm'); } return $view->nest('commentForm', 'default/site/blog/comment_form', array('post' => $viewdata['post'])); }); Route::filter('json', function () { Api::$type = 'json'; }); Route::filter('xml', function () { Api::$type = 'xml'; }); Route::when('json', 'json'); Route::when('xml', 'xml'); Route::filter('checkuser', function () { if (Auth::check()) { DB::update('UPDATE users SET last_activity = ? WHERE id = ?', array(date('Y-m-d H:i:s', time()), Auth::user()->id)); if (!Request::ajax()) { Activity::log(array('contentID' => Confide::user()->id, 'contentType' => 'activity', 'description' => 'Page Loaded', 'details' => '<a href="' . $_SERVER['REQUEST_URI'] . '" target="_new" class="btn">link</a>', 'updated' => Confide::user()->id ? true : false)); } $value = Cache::remember('valid_user', '1', function () { return Auth::user()->confirmed != '1' ? true : false; }); if ($value) { Confide::logout();