Sounds like a perfect many to many relationship. The docs uses almost the same. (Users and roles instead of roles and permissions) For first step, take a look at here:
Class Role extends Model{
public function permissions() {
return $this->belongsToMany(App\Permission::class, 'role_has_permissions');
}
}
Class Permission extends Model{
public function roles() {
return $this->belongsToMany(App\Role::class, 'role_has_permissions');
}
}
So lets say yo want to retrieve all the permissions name of a role