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


PHP Task::count方法代碼示例

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


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

示例1: index

 public function index()
 {
     // 사용자, 프로젝트, 태스트 수 가져오기
     $uc = User::count();
     $pc = Project::count();
     $tc = Task::count();
     $total = ['user' => $uc, 'project' => $pc, 'task' => $tc];
     // 뷰에 전달
     return view('main')->with('total', $total);
 }
開發者ID:richellin,項目名稱:laravel5.2-auth,代碼行數:10,代碼來源:DashboardController.php

示例2: count

 /**
  * Count all the tasks	
  *
  * @return int
  */
 public function count()
 {
     return Task::count();
 }
開發者ID:sergiu05,項目名稱:laravel5-task-list,代碼行數:9,代碼來源:TaskRepository.php

示例3: stestTasksCreated

 public function stestTasksCreated()
 {
     $project = Project::firstOrCreate($this->projectdata);
     $task = Task::create($this->taskdata);
     $project->tasks()->save($task);
     $user = User::firstOrFail();
     $task->owner()->associate($user);
     event(new TaskCreated($user, $project, $task));
     $this->assertEquals(1, Task::count());
     $this->assertEquals(TaskCreated::class, $task->feed->type);
     $this->assertEquals($task->project->id, $task->feed->project_id);
     $this->assertEquals(0, $task->comments->count());
     $comment = Comment::create($this->commentdata);
     $task->comments()->save($comment);
     $this->assertEquals(1, $task->comments()->count());
 }
開發者ID:bluecipherz,項目名稱:bczapi,代碼行數:16,代碼來源:ModelsTest.php

示例4: destroy

 public function destroy(Request $request, $id)
 {
     $task = Task::findOrFail($id);
     $task->delete();
     return Response::json(['success' => 1, 'message' => 'task deleted', 'tasks_count' => Task::count()]);
 }
開發者ID:ahmedash95,項目名稱:todos,代碼行數:6,代碼來源:TasksController.php


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