laravel - 如何使用一个视图和多个守卫 Laravel
问题描述
我的系统中有多个警卫
Admin
User
管理员和用户都可以添加组织详细信息,但它们具有不同的模板布局。我现在在做什么我像这样创建每个警卫的视图
views
user
organizations
index.blade.php
_form.blade.php
create.blade.php
edit.blade.php
admin
organizations
index.blade.php
_form.blade.php
create.blade.php
edit.blade.php
现在我想创建一个视图,可供具有不同布局的多个警卫使用
views
organizations
index.blade.php
_form.blade.php
create.blade.php
edit.blade.php
解决方案
如果需要,您可以指定在使用 @auth 和 @guest 指令时应检查的身份验证保护:
@auth('admin')
// The user is authenticated...
@endauth
@guest('admin')
// The user is not authenticated...
@endguest
推荐阅读
- javascript - setTimeout() 和函数范围
- sql - PostgreSQL 函数的结果集参数
- github - 如何提取 GitHub 市场上每个应用的安装数量?
- bootstrap-4 - 左侧的图标和右侧的按钮
- node.js - nodejs express验证器单独文件问题
- sql - SQL总和在一个时间间隔/行
- java - Spring MVC @Controller 的处理程序方法的参数如何在运行时自动解析?
- java - Spring Boot - PostMapping 不起作用
- firebase - 订阅流并在颤振飞镖中转发
- javascript - 如何在php中执行javascript代码?