Comments (5)
Hi,
I was following steps you describe and at the end, it works for me.
$user = User::find(1);
if ($user->is('admin')) // or you can pass an id
{
return 'admin';
}
This check returns true
to me. So I don't know what is the problem for you.
from roles.
($ User-> is ('admin')) there says he can spend this refers ID?
.... and there is the error I get, any ideas?
you work in laravel 5.0 or 5.0.1?
sorry for my bad English
from roles.
Ignore error from PhpStorm.
Try this check:
$user = User::find(1);
if ($user->is('administrator')) // or you can pass an id
{
return 'admin';
}
Argument must be id
or slug
(slug is without upper letters and spaces)!
from roles.
Ooooh thanks!!! slug is the argument, work it!! I thought it was the Argument was name,
and my error is a uppercase Administrator to administrator.
excellent plugin, very easy to use for a beginner like me and functional.
Now I do not need but is there any way to check the level?
from roles.
Yes, there is!
$user = User::find(1);
echo $user->level();
For more info, please read readme file.
Closing.
from roles.
Related Issues (20)
- how to use middleware in controller with 'or' condition
- Unique property on field slug in the roles table
- can() method judge super admin role has all permission by default
- managing permissions by role HOT 22
- About 1050 Table 'role_user' already exists
- Migrations broken in 5.3
- Declaration of Illuminate\Database\Eloquent\Model::is HOT 2
- user model issue using laravel 5.3 HOT 3
- How to get all roles without User
- Replace foreign keys
- Rollbac migration error Laravel 5.2 HOT 1
- User.php error HOT 1
- Class 'App\Model' not found HOT 1
- How I can get all users which have Role admin
- hasPermission inside VerifyPermission is not working properly HOT 3
- Is there support AND/OR operatos in the middleware?
- Is this project maintained any more? HOT 2
- This Project is DEAD. HOT 2
- Error (1/1) FatalErrorException Interface
- hasRole and permission works with $key not $value HOT 1
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 roles.