xxxxxxxxxx
@role('customer')
I am a Customer!
@else
I am not a Customer
@endrole
xxxxxxxxxx
@if ( auth()->user()->roles->pluck('name')[0] ?? '' === 'customer' )
<h1>Hello Customer {{auth()->user()->name }}</h1>
@endif
xxxxxxxxxx
{{ Auth::user()->roles->pluck('name')[0] ?? '' }}
// or with the auth() helper:
{{ auth()->user()->roles->pluck('name')[0] ?? '' }}
// output: "customer"