当前位置:网站首页>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>
边栏推荐
- 智能网关助力提高工业数据采集和利用
- Hands on deep learning (33) -- style transfer
- Write a mobile date selector component by yourself
- Summary of the most comprehensive CTF web question ideas (updating)
- Hands on deep learning (37) -- cyclic neural network
- Ultimate bug finding method - two points
- Exercise 9-3 plane vector addition (15 points)
- Deadlock in channel
- Exercise 8-7 string sorting (20 points)
- libmysqlclient.so.20: cannot open shared object file: No such file or directory
猜你喜欢
2. Data type
Hands on deep learning (46) -- attention mechanism
Custom type: structure, enumeration, union
Servlet基本原理与常见API方法的应用
SSM online examination system source code, database using mysql, online examination system, fully functional, randomly generated question bank, supporting a variety of question types, students, teache
入职中国平安三周年的一些总结
Hands on deep learning (38) -- realize RNN from scratch
Hands on deep learning (32) -- fully connected convolutional neural network FCN
El Table Radio select and hide the select all box
Hands on deep learning (44) -- seq2seq principle and Implementation
随机推荐
Deep learning 500 questions
On Multus CNI
Nuxt reports an error: render function or template not defined in component: anonymous
百度研发三面惨遭滑铁卢:面试官一套组合拳让我当场懵逼
Hands on deep learning (37) -- cyclic neural network
Write a jison parser from scratch (6/10): parse, not define syntax
Golang defer
System. Currenttimemillis() and system Nanotime (), which is faster? Don't use it wrong!
Daughter love: frequency spectrum analysis of a piece of music
2022-2028 global small batch batch batch furnace industry research and trend analysis report
技术管理进阶——如何设计并跟进不同层级同学的绩效
Are there any principal guaranteed financial products in 2022?
Deadlock in channel
How does idea withdraw code from remote push
pcl::fromROSMsg报警告Failed to find match for field ‘intensity‘.
Explanation of closures in golang
El Table Radio select and hide the select all box
C # use smtpclient The sendasync method fails to send mail, and always returns canceled
5g/4g wireless networking scheme for brand chain stores
How to teach yourself to learn programming