本文整理汇总了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'));
}
示例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'));
}
示例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()]);
}
示例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);
}
示例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'));
}
示例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())]);
}
示例7: all
public function all()
{
return Task::latest()->get();
}
示例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'));
}
示例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'));
}