itstructure/laravel-rbac

User Model class must be implemented from "Itstructure\LaRbac\Interfaces\RbacUserInterface".

Opened this issue · 5 comments

Status:

New fresh laravel Installation (v9.22.1)
Setting .env database correctly.
run command:
composer require itstructure/laravel-rbac "~3.0.6"
php artisan rbac:publish
After this, i don'touch anything in config/rbac.php, because my User model is in the standard position (app\Models\User), but if i run php artisan rbac:database, return this error:
2020_07_11_151834_create_user_role_table ....................................................................... 1ms FAIL Failed! User Model class must be implemented from "Itstructure\LaRbac\Interfaces\RbacUserInterface".
All files are untouched from standard installation.

Hi I am also facing the same issue

you have to implement the said interface and its stub in your user class model, in my case it solve error to be thrown

`
use Itstructure\LaRbac\Interfaces\RbacUserInterface;
use Itstructure\LaRbac\Traits\Administrable;

class User extends Authenticatable implements RbacUserInterface
{
use HasApiTokens, Administrable, HasFactory, Notifiable;
.......
`

Change user model like above it works for me.

Yes, your User model must be implemented by Itstructure\LaRbac\Interfaces\RbacUserInterface interface and must contain its methods.
And use Itstructure\LaRbac\Traits\Administrable trait in a User model.