当前位置:网站首页>Laravel文档阅读笔记-How to use @auth and @guest directives in Laravel
Laravel文档阅读笔记-How to use @auth and @guest directives in Laravel
2022-07-04 09:35:00 【IT1995】
Laravel文档阅读笔记-How to use @auth and @guest directives in Laravel
这个是我在阅读Laravel8中的文档时遇到的。在此阅读下@auth和@guest的用法。
下面将说明@auth和@guest在Laravel中的使用。
这两个关键字其实是代替@if、@endif的。
如下使用@if、@endif
@if(auth()->user())
// The user is authenticated.
@endif当用户有权限,就在blade中显示。
使用@auth和@guest可以简化成这样的:
@auth
// The user is authenticated.
@endauth和
@guest
// The user is not authenticated.
@endguest在个人项目中,我是这样用的
<nav class="navbar navbar-dark bg-dark" style="z-index:999">
<div class="container-fluid">
<a class="navbar-brand" href="/">it1995.cn</a>
<ul class="navbar-nav justify-content-end">
@guest
<li class="nav-item">
<a class="nav-link text-white" href="{
{route('login')}}">登录</a>
</li>
@else
<li class="nav-item">
<div class="row">
<div class="col">
<a class="nav-link text-white" href="{
{route('dashboard')}}">管理</a>
</div>
<div class="col">
<a class="nav-link text-white" href="{
{route('signOut')}}">退出</a>
</div>
</div>
</li>
@endguest
</ul>
</div>
</nav>
边栏推荐
- Histogram equalization
- Are there any principal guaranteed financial products in 2022?
- Qtreeview+ custom model implementation example
- How do microservices aggregate API documents? This wave of show~
- [on February 11, 2022, the latest and most fully available script library collection of the whole network, a total of 23]
- Hands on deep learning (32) -- fully connected convolutional neural network FCN
- IIS configure FTP website
- Lauchpad x | MODE
- Hands on deep learning (34) -- sequence model
- 2022-2028 global edible probiotic raw material industry research and trend analysis report
猜你喜欢

How can people not love the amazing design of XXL job

QTreeView+自定义Model实现示例

PHP is used to add, modify and delete movie information, which is divided into foreground management and background management. Foreground users can browse information and post messages, and backgroun

El Table Radio select and hide the select all box

Hands on deep learning (44) -- seq2seq principle and Implementation

技术管理进阶——如何设计并跟进不同层级同学的绩效

2022-2028 global optical transparency industry research and trend analysis report

Hands on deep learning (35) -- text preprocessing (NLP)

Ultimate bug finding method - two points

2022-2028 global small batch batch batch furnace industry research and trend analysis report
随机推荐
Mmclassification annotation file generation
Summary of small program performance optimization practice
Global and Chinese market of wheel hubs 2022-2028: Research Report on technology, participants, trends, market size and share
智能网关助力提高工业数据采集和利用
7-17 crawling worms (15 points)
2022-2028 global strain gauge pressure sensor industry research and trend analysis report
2021-08-11 function pointer
PHP student achievement management system, the database uses mysql, including source code and database SQL files, with the login management function of students and teachers
智慧路灯杆水库区安全监测应用
Rules for using init in golang
Explanation of for loop in golang
Write a jison parser from scratch (6/10): parse, not define syntax
Launpad | 基礎知識
mmclassification 标注文件生成
C # use gdi+ to add text to the picture and make the text adaptive to the rectangular area
pcl::fromROSMsg报警告Failed to find match for field ‘intensity‘.
2022-2028 global gasket plate heat exchanger industry research and trend analysis report
Exercise 7-4 find out the elements that are not common to two arrays (20 points)
C语言指针面试题——第二弹
Fatal error in golang: concurrent map writes