-
Notifications
You must be signed in to change notification settings - Fork 216
Blade Extensions
Travis Blasingame edited this page Mar 27, 2017
·
10 revisions
Blade helper extension lets you write a little less code and is more elegant.
Use standard @else
tag to negate role or permission if required.
// @if(Auth::check() && Auth::user()->isRole('admin|moderator'))
// would be
@role('admin|moderator')
// content allowed for admin's only
@endrole
// @if(Auth::check() && Auth::user()->hasPermission('create.user|edit.user''))
// would be
@permission('create.user|edit.user')
// content if user can edit or create users.
@else
// content if user cannot edit or create users.
@endpermission