Laravel Gips Pivot Table

<?php
 
namespace App\Models;
 
use Illuminate\Database\Eloquent\Model;
 
class Role extends Model
{
    /**
     * The users that belong to the role.
     */
    public function users()
    {
        return $this->belongsToMany(User::class)->using(RoleUser::class);
    }
}
/**
*When defining the RoleUser model, you should extend the 
Illuminate\Database\Eloquent\Relations\Pivot
*/
<?php
 
namespace App\Models;
 
use Illuminate\Database\Eloquent\Relations\Pivot;
 
class RoleUser extends Pivot
{
    //
}
Aashiq Hasnat