hasMany(RolePermission::class); } public function permissions() { return $this->hasManyThrough( Permission::class, RolePermission::class, 'role_id', 'id', 'id', 'permission_id', ); } public function users() { return $this->hasMany(User::class); } }