Comments (2)
Hi @realtebo ,
It's already documented - you must have not read Step 7 in the installation docs? It's exactly about how to fix the can()
directive:
I've just tried following those docs and setting the guard to null
and it worked like a charm for me:
If you want to test the same thing as above you can use this code for your dashboard or custom page:
@extends(backpack_view('blank'))
@section('content')
<h5>Roles:</h5>
@dump(backpack_user()->roles->pluck('name')->toArray())
<h5>Direct Permissions:</h5>
@dump(backpack_user()->getDirectPermissions()->pluck('name')->toArray())
<h5>Indirect Permissions:</h5>
@dump(backpack_user()->getAllPermissions()->pluck('name')->toArray())
<h5>backpack_user()->role('superadmin')</h5>
@if(backpack_user()->role('superadmin'))
<div class="alert alert-success">
True.
</div>
@else
<div class="alert alert-danger">
False.
</div>
@endif
<h5>backpack_user()->can('manage news')</h5>
@if(backpack_user()->can('manage news'))
<div class="alert alert-success">
True.
</div>
@else
<div class="alert alert-danger">
Not true.
</div>
@endif
<h5>role('superadmin')</h5>
@role('superadmin')
<div class="alert alert-success">
True.
</div>
@else
<div class="alert alert-danger">
Not true.
</div>
@endrole
<h5>hasRole('superadmin')</h5>
@hasrole('superadmin')
<div class="alert alert-success">
True.
</div>
@else
<div class="alert alert-danger">
Not true.
</div>
@endrole
<h5>can('manage news')</h5>
@can('manage news')
<div class="alert alert-success">
True.
</div>
@else
<div class="alert alert-danger">
Not true.
</div>
@endrole
@endsection
Let us know if there's any other problem with using Permission and we can document them. But we don't want to go too deep into explaining how to work with Laravel-Permission. After all... that's its own package, from a different vendor. It's normal to follow their docs, not ours.
Cheers!
from permissionmanager.
Thanks for fast reply, and sorry because my question was posted in the wrong repo.
I think it is perfect, but I think it should be linked as a FAQ in the mai backpack doc because, if you us this package and read this doc, you see how to integrate with backpack.
But if you use laravel-permisision without this addon, you have no clue about what to do to make it works
from permissionmanager.
Related Issues (20)
- Roles index page doesn't load properly. HOT 4
- php artisan migrate, says nothing to migrate HOT 6
- SQLSTATE[HY093]: Invalid parameter number HOT 3
- PermissionManager failing to install on backpack v6 HOT 3
- Add menu item on tabler theme HOT 12
- Login With LDAP HOT 2
- Users can still access the url if they have permisison HOT 2
- Permission Manager Plugin is looking for table users instead of admins HOT 9
- User list not working HOT 2
- [FEATURE] Filtering role and permissions in user CRUD HOT 2
- [Bug] Tests fail possibly trying to load filters on non-PRO setup HOT 7
- Upgrade to `spatie/laravel-permission` v6.1 HOT 5
- Why a new admin account get redirected to /home instead of /admin/dashboard? HOT 6
- How to add 'Select Role(s)' (dropdown) on user create/edit crud view (and get it to save)? HOT 2
- User edit: Default empty password behavior HOT 7
- $user->roles() returning collection of 'false' values HOT 6
- INDUSTRIAL TRAINING REPORT ON HOT 2
- The attribute [password_confirmation] either does not exist or... HOT 4
- Orderable on columns of type custom_column has not been disabled HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from permissionmanager.