Support the ongoing development of →
posted 9 years ago
Last updated 1 year ago.

in your migration table should be role_users if not got to the function in your class: class User extends Model....

public function roles() {
    return $this->belongsToMany('App\Role', 'your table name','the name of column if different from convention')

SO DO: ...return $this->belongsToMany('App\Role', 'role_user');

Should work.

Last updated 8 years ago.

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.