public function myProjects($userId)
 {
     $this->userId = $userId;
     $data = array('status' => false);
     try {
         $projects = $this->project->byUser($userId)->active()->get();
         $todogroups = TodoGroup::grouplist();
         $todoPriority = TodoPriority::getPriorities();
         $data['status'] = true;
         $data['data'] = array('projects' => $projects, 'todogroups' => $todogroups, 'todoPriority' => $todoPriority);
     } catch (Exception $e) {
         $data['error'] = $e->getMessage();
         $data['data'] = array();
     }
     return Response::JSON($data);
 }
示例#2
0
 public function getTodo($id = null, $userId = null)
 {
     $projects = Project::byUser($userId)->active()->select('name', 'id')->get();
     $todogroups = TodoGroup::grouplist();
     $todoPriorities = TodoPriority::getPriorities();
     $todo = $this->todo->withProject()->withPriority()->withGroup()->find($id);
     $todo['todo_status'] = $this->statusArray[$todo['todo_status']];
     return Response::JSON(array('todo' => $todo, 'projects' => $projects, 'todogroups' => $todogroups, 'todoPriorities' => $todoPriorities));
 }