本文整理匯總了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()]);
}