public function task($id)
 {
     $task = Task::where('id', $id)->get();
     if (empty($task) || count($task) == 0) {
         abort(404);
     } else {
         var_dump($task[0]);
     }
 }
Exemple #2
0
 /**
  * タスク一覧
  */
 public function getIndex($projectId)
 {
     // プロジェクトの存在チェック
     $project = $this->checkProject($projectId);
     if (!$project) {
         \Session::flash('flash_message', 'タスクが存在しません。');
         return redirect('/');
     }
     // タスク一覧取得
     $tasks = Task::where('project_id', $projectId)->orderBy('seq', 'asc')->get();
     // ステータス定義
     $statusList = array('before_work' => '作業前', 'working' => '作業中', 'after_work' => '作業後');
     // 優先度定義
     $priorityList = array('10' => '低', '20' => '中', '30' => '高');
     return view('tasks.index', compact('tasks', 'project', 'statusList', 'priorityList'));
 }
 /**
  * Get all of the tasks for a given user.
  *
  * @param  User  $user
  * @return Collection
  */
 public function forUser(User $user)
 {
     return Task::where('user_id', $user->id)->orderBy('created_at', 'asc')->get();
 }