當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Task::latest方法代碼示例

本文整理匯總了PHP中app\Task::latest方法的典型用法代碼示例。如果您正苦於以下問題:PHP Task::latest方法的具體用法?PHP Task::latest怎麽用?PHP Task::latest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Task的用法示例。


在下文中一共展示了Task::latest方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: index

 /**
  * 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'));
 }
開發者ID:benjyspider,項目名稱:tasks-laravel5,代碼行數:12,代碼來源:TasksController.php

示例2: index

 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'));
 }
開發者ID:rbmulani7009,項目名稱:laravel-test,代碼行數:10,代碼來源:TasksController.php

示例3: dashboard

 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()]);
 }
開發者ID:BostjanOb,項目名稱:ProTODO,代碼行數:13,代碼來源:ProjectController.php

示例4: index

 /**
  * 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);
 }
開發者ID:OrelienG,項目名稱:tasks-laravel5,代碼行數:10,代碼來源:TasksController.php

示例5: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $tasks = Task::latest('id')->get();
     return view('tasks.index', compact('tasks'));
 }
開發者ID:OrelienG,項目名稱:Zimbabwe,代碼行數:10,代碼來源:TasksController.php

示例6: index

 /**
  * 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())]);
 }
開發者ID:kdj1219,項目名稱:laravel5,代碼行數:10,代碼來源:TaskController.php

示例7: all

 public function all()
 {
     return Task::latest()->get();
 }
開發者ID:luismec90,項目名稱:laravel-todo-app-best-practices,代碼行數:4,代碼來源:EloquentTaskRepository.php

示例8: dashBoard

 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'));
 }
開發者ID:macewanCS,項目名稱:lackingllamas,代碼行數:6,代碼來源:DashboardController.php

示例9: index

 /**
  * 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'));
 }
開發者ID:premsingh4github,項目名稱:modulebuilder,代碼行數:11,代碼來源:TasksController.php


注:本文中的app\Task::latest方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。