当前位置:网站首页>Lavel document reading notes -how to use @auth and @guest directives in lavel
Lavel document reading notes -how to use @auth and @guest directives in lavel
2022-07-04 09:51:00 【IT1995】
Laravel Document reading notes -How to use @auth and @guest directives in Laravel
This is what I'm reading Laravel8 Encountered in the document in . Read here @auth and @guest Usage of .
The following is illustrated @auth and @guest stay Laravel The use of .
These two keywords actually replace @if、@endif Of .
Use the following @if、@endif
@if(auth()->user())
// The user is authenticated.
@endif
When the user has permission , It's just blade It shows that .
Use @auth and @guest It can be simplified into this :
@auth
// The user is authenticated.
@endauth
and
@guest
// The user is not authenticated.
@endguest
In personal projects , This is how I use it
<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')}}"> Sign in </a>
</li>
@else
<li class="nav-item">
<div class="row">
<div class="col">
<a class="nav-link text-white" href="{
{route('dashboard')}}"> management </a>
</div>
<div class="col">
<a class="nav-link text-white" href="{
{route('signOut')}}"> sign out </a>
</div>
</div>
</li>
@endguest
</ul>
</div>
</nav>
边栏推荐
- Write a jison parser from scratch (3/10): a good beginning is half the success -- "politics" (Aristotle)
- Exercise 9-3 plane vector addition (15 points)
- MATLAB小技巧(25)竞争神经网络与SOM神经网络
- Kotlin: collection use
- Exercise 9-4 finding books (20 points)
- Hands on deep learning (42) -- bi-directional recurrent neural network (BI RNN)
- Golang defer
- Hands on deep learning (34) -- sequence model
- Vanishing numbers
- How web pages interact with applets
猜你喜欢
华为联机对战如何提升玩家匹配成功几率
Hands on deep learning (32) -- fully connected convolutional neural network FCN
Log cannot be recorded after log4net is deployed to the server
JDBC and MySQL database
2022-2028 global protein confectionery industry research and trend analysis report
Hands on deep learning (46) -- attention mechanism
2022-2028 global industrial gasket plate heat exchanger industry research and trend analysis report
How does idea withdraw code from remote push
Hands on deep learning (40) -- short and long term memory network (LSTM)
C语言指针面试题——第二弹
随机推荐
C # use gdi+ to add text with center rotation (arbitrary angle)
Fatal error in golang: concurrent map writes
Problems encountered by scan, scanf and scanln in golang
智能网关助力提高工业数据采集和利用
Daughter love: frequency spectrum analysis of a piece of music
Exercise 8-7 string sorting (20 points)
Leetcode (Sword finger offer) - 35 Replication of complex linked list
Hands on deep learning (40) -- short and long term memory network (LSTM)
Dynamic memory management
Les différents modèles imbriqués de listview et Pageview avec les conseils de flutter
Get the source code in the mask with the help of shims
【leetcode】540. A single element in an ordered array
mmclassification 标注文件生成
什么是 DevSecOps?2022 年的定义、流程、框架和最佳实践
Baidu R & D suffered Waterloo on three sides: I was stunned by the interviewer's set of combination punches on the spot
Hands on deep learning (45) -- bundle search
Exercise 9-5 address book sorting (20 points)
Hands on deep learning (33) -- style transfer
Qtreeview+ custom model implementation example
Write a jison parser (7/10) from scratch: the iterative development process of the parser generator 'parser generator'