belongsToMany( config('permissions.models.role'), config('permissions.table_names.model_has_roles'), 'model_id', 'role_id' ); } /** * Check if the model has a specific role. * * @param string $role * @return bool */ public function hasRole($role) { return $this->roles()->where('name', $role)->exists(); } }