當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Gate::allows方法代碼示例

本文整理匯總了PHP中Illuminate\Support\Facades\Gate::allows方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gate::allows方法的具體用法?PHP Gate::allows怎麽用?PHP Gate::allows使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Support\Facades\Gate的用法示例。


在下文中一共展示了Gate::allows方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: update

 public function update(Request $request, PersonModel $person)
 {
     $person->setName($request->input('name'))->setEnabled($request->has('enabled'));
     if (Gate::allows('editSuperuser', $person)) {
         $person->setSuperuser($request->has('superuser'));
     }
     PersonFacade::save($person);
 }
開發者ID:boomcms,項目名稱:boom-core,代碼行數:8,代碼來源:Person.php

示例2: __construct

 public function __construct()
 {
     if (!Gate::allows('manage-university')) {
         abort(403);
     }
     $this->middleware('auth');
     if (auth()->check()) {
         $this->university = auth()->user()->university;
     }
 }
開發者ID:BootySYS,項目名稱:bootysys,代碼行數:10,代碼來源:StudentsController.php

示例3: compose

 public function compose(View $view)
 {
     $view->sidebar->group(trans('global.menus.social'), function (SidebarGroup $group) {
         $group->addItem(trans('reasons::global.name'), function (SidebarItem $item) {
             $item->icon = config('typicms.reasons.sidebar.icon');
             $item->weight = config('typicms.reasons.sidebar.weight');
             $item->route('admin::index-reasons');
             $item->append('admin::create-reason');
             $item->authorize(Gate::allows('index-reasons'));
         });
     });
 }
開發者ID:webfactorybulgaria,項目名稱:reasons,代碼行數:12,代碼來源:SidebarViewComposer.php

示例4: compose

 public function compose(View $view)
 {
     $view->sidebar->group(trans('global.menus.content'), function (SidebarGroup $group) {
         $group->addItem(trans('blocks::global.name'), function (SidebarItem $item) {
             $item->id = 'blocks';
             $item->icon = config('typicms.blocks.sidebar.icon', 'icon fa fa-fw fa-list-alt');
             $item->weight = config('typicms.blocks.sidebar.weight');
             $item->route('admin::index-blocks');
             $item->append('admin::create-block');
             $item->authorize(Gate::allows('index-blocks'));
         });
     });
 }
開發者ID:webfactorybulgaria,項目名稱:Blocks,代碼行數:13,代碼來源:SidebarViewComposer.php

示例5: compose

 public function compose(View $view)
 {
     $view->sidebar->group(trans('global.menus.newsletter'), function (SidebarGroup $group) {
         $group->id = 'newsletter';
         $group->weight = 20;
         $group->addItem(trans('newsletter::global.name'), function (SidebarItem $item) {
             $item->icon = config('typicms.newsletter.sidebar.icon', 'icon fa fa-fw fa-envelope');
             $item->weight = config('typicms.newsletter.sidebar.weight');
             $item->route('admin::index-newsletter');
             $item->append('admin::create-newsletter');
             $item->authorize(Gate::allows('newsletter.index'));
         });
     });
 }
開發者ID:webfactorybulgaria,項目名稱:newsletter,代碼行數:14,代碼來源:SidebarViewComposer.php

示例6: compose

 public function compose(View $view)
 {
     $view->sidebar->group(trans('global.menus.shop'), function (SidebarGroup $group) {
         $group->id = 'shop';
         $group->weight = 2;
         $group->addItem(trans('attributes::global.name'), function (SidebarItem $item) {
             $item->icon = config('typicms.attributes.sidebar.icon');
             $item->weight = config('typicms.attributes.sidebar.weight');
             $item->route('admin::index-attribute_groups');
             $item->append('admin::create-attribute_group');
             $item->authorize(Gate::allows('index-attribute_groups'));
         });
     });
 }
開發者ID:webfactorybulgaria,項目名稱:attributes,代碼行數:14,代碼來源:SidebarViewComposer.php

示例7: index

 public function index()
 {
     $model = new Order();
     $dataGrid = DataGrid::make($model);
     $dataGrid->addColumn(DataGrid::textColumn('id', 'Order ID'));
     $dataGrid->addColumn(DataGrid::textColumn('shipping_method', 'Shipping Method'));
     $dataGrid->addColumn(DataGrid::textColumn('payment_method', 'Payment Method'));
     $dataGrid->addColumn(DataGrid::textColumn('order_status_title', 'Order Status'));
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.order.view"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('view', 'View', function ($row) {
             return "<a href='" . route('admin.order.view', $row->id) . "'>View</a>";
         }));
     }
     return view('admin.order.index')->with('dataGrid', $dataGrid);
 }
開發者ID:mage2,項目名稱:laravel-ecommerce,代碼行數:15,代碼來源:OrderController.php

示例8: compose

 public function compose(View $view)
 {
     $view->sidebar->group('dashboard', function (SidebarGroup $group) {
         $group->id = 'dashboard';
         $group->weight = 10;
         $group->hideHeading();
         $group->addItem(trans('dashboard::global.name'), function (SidebarItem $item) {
             $item->id = 'dashboard';
             $item->icon = config('typicms.dashboard.sidebar.icon', 'icon fa fa-fw fa-dashboard');
             $item->weight = config('typicms.dashboard.sidebar.weight');
             $item->route('dashboard');
             $item->authorize(Gate::allows('dashboard'));
         });
     });
 }
開發者ID:webfactorybulgaria,項目名稱:Dashboard,代碼行數:15,代碼來源:SidebarViewComposer.php

示例9: registerFrontendMenu

 /**
  * build frontend menu and attach it to view.
  */
 private function registerFrontendMenu()
 {
     $this->app->singleton('menu.frontend', function () {
         return Menu::create('frontend');
     });
     View::composer('vain::app', function ($view) {
         $handler = app('menu.frontend');
         $view->with('menu', $handler);
         // inject home item
         $handler->addChild('Home')->setUri(route('index.home'))->setExtra('icon', 'home');
         if (Gate::allows('app.admin.show')) {
             $handler->addChild('Admin Panel')->setUri(route('user.admin.users.index'))->setExtra('icon', 'tachometer');
         }
         Event::fire(new FrontendMenuCreated($handler, $view));
     });
 }
開發者ID:vainproject,項目名稱:vain,代碼行數:19,代碼來源:MenuServiceProvider.php

示例10: tearDown

 /**
  * Teardown block setup
  */
 public static function tearDown()
 {
     $html = ob_get_clean();
     end(self::$models);
     $slug = key(self::$models);
     $title = array_pop(self::$models);
     /** @var Block $block */
     $block = Block::where('slug', $slug)->first();
     if (!$block) {
         $block = new Block(['slug' => $slug, 'title' => $title, 'content' => trim($html)]);
         $block->save();
     }
     if (Gate::allows('edit-html-blocks')) {
         return sprintf('<html-block slug="%s">%s</html-block>', $slug, trim($block->content));
     }
     return trim($block->content);
 }
開發者ID:dyusha,項目名稱:laravel-html-editor,代碼行數:20,代碼來源:HtmlBlocks.php

示例11: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $model = new TaskStatus();
     $dataGrid = DataGrid::make($model);
     $dataGrid->addColumn(DataGrid::textColumn('name', 'Status Name', ['sortable' => 'asc']));
     if (Gate::allows('hasPermission', [AdminUser::class, "setup.task-status.edit"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('edit', 'Edit', function ($row) {
             return "<a href='" . route('setup.task-status.edit', $row->id) . "'>Edit</a>";
         }));
     }
     if (Gate::allows('hasPermission', [AdminUser::class, "setup.task-status.destroy"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('destroy', 'Destroy', function ($row) {
             return "<form method='post' action='" . route('setup.task-status.destroy', $row->id) . "'>" . "<input type='hidden' name='_method' value='delete'/>" . csrf_field() . '<a href="#" onclick="jQuery(this).parents(\'form:first\').submit()">Destroy</a>' . "</form>";
         }));
     }
     return view('setup.task-status.index')->with('dataGrid', $dataGrid);
 }
開發者ID:mage2,項目名稱:project-management-system,代碼行數:22,代碼來源:TaskStatusController.php

示例12: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $role = new Role();
     $dataGrid = DataGrid::make($role);
     $dataGrid->addColumn(DataGrid::textColumn('name', 'Role Name'));
     $dataGrid->addColumn(DataGrid::textColumn('description', 'Role Description'));
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.role.edit"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('edit', 'Edit', function ($row) {
             return "<a href='" . route('admin.role.edit', $row->id) . "'>Edit</a>";
         }));
     }
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.role.edit"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('destroy', 'Destroy', function ($row) {
             return "<form method='post' action='" . route('admin.role.destroy', $row->id) . "'>" . "<input type='hidden' name='_method' value='delete'/>" . csrf_field() . '<a href="#" onclick="jQuery(this).parents(\'form:first\').submit()">Destroy</a>' . "</form>";
         }));
     }
     return view('admin.user.role.index')->with('dataGrid', $dataGrid);
 }
開發者ID:mage2,項目名稱:laravel-ecommerce,代碼行數:23,代碼來源:RoleController.php

示例13: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $model = new OrderStatus();
     $dataGrid = DataGrid::make($model);
     $dataGrid->addColumn(DataGrid::textColumn('id', 'Order ID'));
     $dataGrid->addColumn(DataGrid::textColumn('title', 'Title'));
     $dataGrid->addColumn(DataGrid::textColumn('is_default', 'Is Default'));
     $dataGrid->addColumn(DataGrid::textColumn('is_last_stage', 'Is Last Stage'));
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.order-status.edit"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('edit', 'Edit', function ($row) {
             return "<a href='" . route('admin.order-status.edit', $row->id) . "'>Edit</a>";
         }));
     }
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.order-status.destroy"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('destroy', 'Destroy', function ($row) {
             return "<form method='post' action='" . route('admin.order-status.destroy', $row->id) . "'>" . "<input type='hidden' name='_method' value='delete'/>" . csrf_field() . '<a href="#" onclick="jQuery(this).parents(\'form:first\').submit()">Destroy</a>' . "</form>";
         }));
     }
     return view('admin.order-status.index')->with('dataGrid', $dataGrid);
 }
開發者ID:mage2,項目名稱:laravel-ecommerce,代碼行數:25,代碼來源:OrderStatusController.php

示例14: table

 /**
  * Returns a table of all labels.
  *
  * @param Label $label
  *
  * @return \Orchestra\Contracts\Html\Builder
  */
 public function table(Label $label)
 {
     return $this->table->of('labels', function (TableGrid $table) use($label) {
         $table->with($label)->paginate($this->perPage);
         $table->sortable(['name']);
         $table->column('name', function (Column $column) {
             $column->label = 'Label';
             $column->value = function (Label $label) {
                 return $label->display_large;
             };
         });
         $table->column('issues', function (Column $column) {
             $column->label = 'Open Issues';
             $column->headers = ['class' => 'hidden-xs'];
             $column->value = function (Label $label) {
                 return $label->issues()->open()->count();
             };
             $column->attributes = function () {
                 return ['class' => 'hidden-xs'];
             };
         });
         // Check if the current user has access to edit
         // labels before rendering the label as a link.
         if (Gate::allows('labels.edit')) {
             $table->column('edit', function (Column $column) {
                 $column->value = function (Label $label) {
                     return link_to_route('labels.edit', 'Edit', [$label->id], ['class' => 'btn btn-xs btn-warning']);
                 };
             });
         }
         // Check if the current user has access to delete
         // labels before rendering the delete column.
         if (Gate::allows('labels.destroy')) {
             $table->column('delete', function (Column $column) {
                 $column->value = function (Label $label) {
                     return link_to_route('labels.destroy', 'Delete', [$label->id], ['data-post' => 'DELETE', 'data-title' => 'Delete Label?', 'data-message' => 'Are you sure you want to delete this label?', 'class' => 'btn btn-xs btn-danger']);
                 };
             });
         }
     });
 }
開發者ID:stevebauman,項目名稱:ithub,代碼行數:48,代碼來源:LabelPresenter.php

示例15: index

 public function index()
 {
     $model = new Review();
     $dataGrid = DataGrid::make($model);
     $dataGrid->addColumn(DataGrid::textColumn('id', 'Id'));
     $dataGrid->addColumn(DataGrid::textColumn('user_name', 'User Name'));
     $dataGrid->addColumn(DataGrid::textColumn('product_title', 'Product Title'));
     $dataGrid->addColumn(DataGrid::textColumn('star', 'Product Title'));
     $dataGrid->addColumn(DataGrid::textColumn('status', 'Status'));
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.review.edit"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('edit', 'Edit', function ($row) {
             return "<a href='" . route('admin.review.edit', $row->id) . "'>Edit</a>";
         }));
     }
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.review.destroy"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('destroy', 'Destroy', function ($row) {
             return "<form method='post' action='" . route('admin.review.destroy', $row->id) . "'>" . "<input type='hidden' name='_method' value='delete'/>" . csrf_field() . '<a href="#" onclick="jQuery(this).parents(\'form:first\').submit()">Destroy</a>' . "</form>";
         }));
     }
     return view('admin.review.index')->with('dataGrid', $dataGrid);
 }
開發者ID:mage2,項目名稱:laravel-ecommerce,代碼行數:21,代碼來源:ReviewController.php


注:本文中的Illuminate\Support\Facades\Gate::allows方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。