+ return $this->permissions()->where('role_id', '=', $role_id)
+ ->where('action', '=', $action)->count() > 0;
+ }
+
+ /**
+ * Check if this entity has live (active) restrictions in place.
+ * @param $role_id
+ * @param $action
+ * @return bool
+ */
+ public function hasActiveRestriction($role_id, $action)
+ {
+ return $this->getRawAttribute('restricted') && $this->hasRestriction($role_id, $action);
+ }
+
+ /**
+ * Get the entity jointPermissions this is connected to.
+ * @return \Illuminate\Database\Eloquent\Relations\MorphMany
+ */
+ public function jointPermissions()
+ {
+ return $this->morphMany(JointPermission::class, 'entity');