本文整理汇总了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);
}
示例2: count
/**
* Count all the tasks
*
* @return int
*/
public function count()
{
return Task::count();
}
示例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());
}
示例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()]);
}