romanbican / roles

Powerful package for handling roles and permissions in Laravel 5
MIT License
1.16k stars 296 forks source link

Class 'App\Model' not found #205

Open kantsverma opened 7 years ago

kantsverma commented 7 years ago

I have implement the all steps and integrated everything successfully But i am getting this error after login using "Class 'App\Model' not found"

Below is my user model :-

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

use Bican\Roles\Traits\HasRoleAndPermission;
use Bican\Roles\Contracts\HasRoleAndPermission as HasRoleAndPermissionContract;

class User extends Model implements AuthenticatableContract, CanResetPasswordContract, HasRoleAndPermissionContract
{
    use Authenticatable, CanResetPassword, HasRoleAndPermission;
    use Notifiable;

    protected $fillable = [
        'name', 'email', 'password',
    ];

    protected $hidden = [
        'password', 'remember_token',
    ];

    // delete the user detail table entry when delete user
    public function users_detail()
    {
        return $this->has_many('users_detail');
    }
    // delete the user role table entry when delete user
    public function role_user()
    {
        return $this->has_many('role_user');
    }   

    // this is a recommended way to declare event handlers
    protected static function boot() {
        parent::boot();

        static::deleting(function($user) { // before delete() method call this
             $user->users_detail()->delete();
             $user->role_user()->delete();
             // do the rest of the cleanup...
        });
    }
}
Ricky-rick commented 7 years ago

Do you have a Model class in the App namespace?

We decided to update and maintain a copy of bican roles. This issue is fixed in this copy. You can find it on packagist: https://packagist.org/packages/ultraware/roles