/**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     /* Suppression de la variable non utilisée $tasks : Resolve as false positive car variable necessaire */
     $tasks = Task::latest('updated_at')->get();
     /* Duplication de 'tasks.index' : Resolve as false positive */
     return view('tasks.index', compact('tasks'));
 }
 public function index()
 {
     $userType = Auth::user()->type;
     if ($userType == "admin" || $userType == "manager") {
         $tasks = Task::latest()->get();
     } else {
         $tasks = Task::where(['taskType' => 'user', 'assignedTo' => Auth::user()->id])->get();
     }
     return view('tasks.index', compact('tasks'));
 }
 public function dashboard()
 {
     $thisWeekDeadline = \DB::select("SELECT COUNT(0) as cnt FROM tasks WHERE completed_at IS NULL AND due_date < ?", [Carbon::now()->addWeek()])[0]->cnt;
     $assignedToYou = \DB::select("SELECT COUNT(0) as cnt \n                                FROM tasks \n                                INNER JOIN task_user ON tasks.id = task_user.task_id\n                                WHERE completed_at IS NULL\n                                AND task_user.user_id = ?", [\Auth::user()->id])[0]->cnt;
     $completedCount = \DB::select("select sum(isnull(completed_at)) as not_completed, sum(not isnull(completed_at)) as completed from tasks group by completed_at;")[0];
     /*$tasksCount = \DB::table('tasks')
               ->select('project_id', 'completed_at', \DB::raw('COUNT(0) total'))
               ->groupBy('project_id', 'completed_at')
               ->get();
       dd($tasksCount);*/
     $latest = Task::latest()->whereNull('completed_at')->with('project')->take(25)->get();
     return view('dashboard.dashboard', ['latest' => $latest, 'thisWeekDeadline' => $thisWeekDeadline, 'assignedToYou' => $assignedToYou, 'completedCount' => $completedCount, 'faker' => \Faker\Factory::create()]);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $data['tasks'] = Task::latest('updated_at')->get();
     return view('tasks.index', $data);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $tasks = Task::latest('id')->get();
     return view('tasks.index', compact('tasks'));
 }
Exemple #6
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $tasks = Task::latest()->get();
     return $this->response(['task_list' => $this->taskTransformer->transformCollection($tasks->toArray())]);
 }
 public function all()
 {
     return Task::latest()->get();
 }
 public function dashBoard(Request $request)
 {
     $tasks = Task::latest('date')->where('userId', $request->user()->id)->get();
     //tasks sorted by date TODO give only users tasks
     return view('dashBoard', compact('tasks'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $tasks = Task::latest()->paginate(20);
     $no = $tasks->firstItem();
     return view('tasks.index', compact('tasks', 'no'));
 }