public static function getFeaturesNotAssignedToCurrentRole($rid) { $features = []; $array = [0]; $features = Role::find($rid)->features()->wherePivot('deleted_at', Null)->get(); foreach ($features as $f) { $array[] = $f->id; } //if(!isset($array)) return []; $feature_result = Feature::whereNotIn('id', $array)->get(); return $feature_result; }
public function assignRoleFeatureForm($role_id) { $assigned_feature_ids = FeatureRole::where('role_id', $role_id)->lists('feature_id'); $features_not_in_role = []; if ($assigned_feature_ids) { $features_not_in_role = Feature::whereNotIn('id', $assigned_feature_ids)->get(); } $role = Role::find($role_id); return view('backend.role.feature_assign')->with('content_title', "Assign Feature")->with('features_not_in_role', $features_not_in_role)->with('role', $role)->with('module', $this->module); }