I did not find how to use a clause (OR, AND) in view with @can, for checking multiple abilities ...
I tried:
@can(['permission1', 'permission2']) @can('permission1' or 'permission2') @can('permission1' || 'permission2')
But dont work ;(
##Permissions This package doesn't add any permission-specific Blade directives. Instead, use Laravel's native @can directive to check if a user has a certain permission. You can use @can , @cannot , @canany , and @guest to test for permission-related access.
Introduction. Want to get started fast? Install the laravel/ui Composer package and run php artisan ui vue --auth in a fresh Laravel application. After migrating your database, navigate your browser to http://your-app.test/register or any other URL that is assigned to your application.
Try use: auth()->check() , \Auth::check() , or remove all views in /var/www/html/laravel-master/storage/framework/views/ . Show activity on this post.
The authentication configuration file is located at config/auth. php , which contains several well documented options for tweaking the behavior of the authentication services. At its core, Laravel's authentication facilities are made up of "guards" and "providers".
You can use the Gate facade:
@if(Gate::check('permission1') || Gate::check('permission2')) @endif
The @canany blade directive has been added to Laravel v.5.6.23 on May 24, 2018
Usage:
@canany(['edit posts', 'delete posts']) <div class="actions"> @can('edit posts') <button>Edit post</button> @endcan @can('delete posts') <button>Delete post</button> @endcan </div> @endcanany
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With