laravel-rbac icon indicating copy to clipboard operation
laravel-rbac copied to clipboard

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

Open Matleyx78 opened this issue 3 years ago • 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.

Matleyx78 avatar Aug 02 '22 06:08 Matleyx78

Hi I am also facing the same issue

Pream-webapps avatar Sep 13 '22 22:09 Pream-webapps

me too

ThuretGbenougan avatar Sep 21 '22 08:09 ThuretGbenougan

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

guntutur avatar Dec 05 '22 05:12 guntutur

` 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.

RosyStephen avatar Jan 25 '23 09:01 RosyStephen

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.

itstructure avatar Mar 22 '24 15:03 itstructure