简体   繁体   中英

How to check if record exists in blade?

I have table for customer and want to redirect to a page if package equal to 1 and customer id equal to current customer id, well I know how to use code for users table but don't know how to use it for customers for users:

@if(auth()->user()->package== 1)

I don't know what ( ->user() ) means!!! what I have to create to let this work for customers? Im sorry Im new in laravel :(

{{ Auth::user()->name }}

使用Auth Facade可以访问经过身份验证的用户数据

您可以在用户表和客户表之间创建一个关系,然后根据需要检查相同的内容以获取更多信息,请检查https://laravel.com/docs/5.5/eloquent-relationships

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM