When you create a brand new project you have users table and User model already by default. So, now create another table with model: php artisan make:model Role -m This will create Role model as well as roles table. Now as it is many to many relation. So we need a pivot table. Pivot table naming convention: role_user Here role is written first as because alphabetically r comes before u. and laravel eloquent relationship takes in this way. So, you should remember this always. and use _ in between role and user. like: role_user So, let's create role_user table. php artisan make:migration create_role_user_table --create=role_user naming covention of pivot says that role_user table is singular. users table includes: id name, email pivot table role_user includes: user_id role_id roles table includes: id name migrate it all. Many to Many Relation: Go to User model and write: public function roles(){ r...
Deal With Errors. Happy coding