-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blade templates #36
Comments
Bouncer works directly with Laravel's gate, so you can use the @can directive: @can ('ability', $model) I consider checking for roles directly an anti-pattern, so we don't ship an @is blade directive. If you insist on checking directly for a role, you can use the standard @if directive: @if ($user->is('admin')) |
Okay, you have reason. It is not neccesary repeat code. Thank you! |
If you want this you can do it your own with a BladeServiceProvider and add this blade tag. But I also don't see any real reason to add this in the package. |
To reiterate, I consider checking for roles directly something that shouldn't really ever be done. To quote the docs:
Like I said above, if you still want to check for a user's role directly, you can use this:
|
I think that this is precisely the reason why there is a |
@Arcesilas Laravel's own ACL has no notion of a role, so it wouldn't make sense for Laravel to ship a |
Ahem... You're right ^^ Sorry, tired nowadays... |
Do you have directives to use in blade templates? or it isn't necessary
For example:
The text was updated successfully, but these errors were encountered: