public function action_destroy_collaborator($project_id, $officer_id) { $collaborator = ProjectCollaborator::where_project_id($project_id)->where_officer_id($officer_id)->where_owner(false)->first(); if ($collaborator) { $collaborator->delete(); } return Response::json(array("status" => "success")); }
public function is_mine() { if (!Auth::user() || !Auth::user()->officer) { return false; } if (self::$my_project_ids === false) { self::$my_project_ids = ProjectCollaborator::where_officer_id(Auth::officer()->id)->lists('project_id'); } if (in_array($this->id, self::$my_project_ids)) { return true; } return false; }