Support the ongoing development of Laravel.io →
posted 9 years ago
Database
Last updated 1 year ago.
0

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

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.