Trait 'App\HasRoles' not found error in laravel 5.6

traits examples
trait in a sentence
what is a trait in biology
how to pronounce trait
trait antonym
personality traits
trait meaning in tamil
dominant trait

I"m try to role permission system by laravel 5.6

when i try to register with default auth(php artisan make:auth) i get this error

"Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN) Trait 'App\HasRoles' not found"

this my model user.php

<?php

namespace App;

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

class User extends Authenticatable
{
    use Notifiable;
    use HasRoles;

    protected $guard_name = 'web'; 

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];
}

I'm guessing you're using the Spatie Laravel Permission package.

If so, you need to import the class like so:

use Spatie\Permission\Traits\HasRoles;

trait, are often labeled with descriptive adjectives such as patient, unfaithful, or jealous. Trait definition, a distinguishing characteristic or quality, especially of one's personal nature: bad traits of character. See more.


Try this. Import HasRoles package as follow;

use Spatie\Permission\Traits\HasRoles;

Trait, refers to a characteristic that is caused by genetics. Define trait. trait synonyms, trait pronunciation, trait translation, English dictionary definition of trait. n. 1. A distinguishing feature, as of a person's character.


The trait wasn't imported for use. If you are using PhpStorm, like me, click on HasRoles, then hold alt key and tap enter, choose import hit enter key and the trait will be imported. You can use these shortcuts to do other imports, for instance, importing models.

Trait, Trait definition is - a distinguishing quality (as of personal character). How to use trait in a sentence. It is a trait, moreover, which finds expression in almost everything he wrote. As one trait disappeared, no other trait sprung up to take its place. No catalogue of American qualities and defects can exclude the trait of individualism. It was this trait in my character which led to the incident I am about to tell you of.


TRAIT, A trait is also a characteristic of an organism that is passed from parent to child. (​Definition of trait from the Cambridge Academic Content  trait definition: 1. a particular characteristic that can produce a particular type of behaviour: 2. a particular…. Learn more.


Trait, A trait is something about you that makes you "you." When your mother says that you get all your best traits from her, she means you have the same charming smile and the same brilliant mind as she has. In science, trait refers to a characteristic that is caused by genetics. In science, trait refers to a characteristic that is caused by genetics. Having green eyes or being shorter than average are traits a person might have. In more general use, a trait is an important part of someone’s personality or appearance.


trait, Trait may refer to: Phenotypic trait in biology, which involve genes and characteristics of organisms; Trait (computer programming), a model for structuring  Trait may refer to: Entertainment [ edit ] Trait (album), the first and only EP by the industrial rock/metal band Pailhead Traits (Joe Morris album)