本文整理汇总了PHP中Illuminate\Support\Facades\View::share方法的典型用法代码示例。如果您正苦于以下问题:PHP View::share方法的具体用法?PHP View::share怎么用?PHP View::share使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\View
的用法示例。
在下文中一共展示了View::share方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
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);
}
示例2:
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());
}
示例3: handle
/**
* 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);
}
示例4: __construct
public function __construct()
{
// $this->middleware('auth');
// Fetch the Site Settings object
$this->currentModelName = Lang::get('crud.shiaiCategory');
View::share('currentModelName', $this->currentModelName);
}
示例5: __construct
public function __construct()
{
$this->middleware('auth');
// Fetch the Site Settings object
$this->currentModelName = Lang::get('crud.competitor');
View::share('currentModelName', $this->currentModelName);
}
示例6: setupLayout
/**
* 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');
}
示例7: process
public function process()
{
$this->runSteps();
View::share('steps', $this->getSteps());
View::share('currentStage', $this);
return View::make(INSTALLER_NAMESPACE . '::stage')->render();
}
示例8: __construct
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;
}
}
}
示例9: handle
/**
* @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());
}
示例10: getToolbar
/**
* 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}");
}
示例11: __construct
/**
* 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'));
}
示例12: __construct
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());
}
示例13: index
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]);
}
示例14: create
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));
}
示例15: index
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]);
}