当前位置: 首页>>代码示例>>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;未经允许,请勿转载。