如何在一个视图中使用多个 Guards Laravel
How to use One view with Multiple Guards 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
来自Laravel Blade Documentation:
如果需要,您可以指定在使用@auth 和@guest 指令时应检查的身份验证保护:
@auth('admin')
// The user is authenticated...
@endauth
@guest('admin')
// The user is not authenticated...
@endguest
我的系统中有多个守卫
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
来自Laravel Blade Documentation:
如果需要,您可以指定在使用@auth 和@guest 指令时应检查的身份验证保护:
@auth('admin')
// The user is authenticated...
@endauth
@guest('admin')
// The user is not authenticated...
@endguest