示例#1
0
 /**
  * Complete a task
  * Used in vue - /tasks/complete-task
  *
  * @param Request $request
  */
 public function completeTask(Request $request)
 {
     $user = auth()->user();
     Task::where('id', $request->task)->where('board_identifier', $request->board)->first()->update(['done' => true, 'completed_by' => $user->id, 'completed_on' => Carbon::now()]);
     return response()->json('Task completed', 200);
 }
示例#2
0
 /**
  * Show deleted tasks
  *
  * @param $identifier
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
  */
 public function deletedTasks($identifier)
 {
     $user = auth()->user();
     $board = Board::where('identifier', $identifier)->first();
     $tasks = Task::where('board_identifier', $identifier)->onlyTrashed()->orderBy('deleted_at', 'desc')->paginate(10);
     foreach ($tasks as $task) {
         $user = User::find($task->user_id);
         $task->createdBy = $user->first_name . ' ' . $user->last_name;
     }
     if (Gate::allows('isOwner', $board)) {
         return view('reports.deleted_tasks', compact('board', 'tasks', 'user'));
     } else {
         return redirect('/boards');
     }
 }