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


PHP Task::whereIn方法代碼示例

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


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

示例1: index

 public function index()
 {
     /** @var Collection $lines */
     $lines = Line::where('visible', true)->orderBy('list_order', 'asc')->get();
     $lineIds = array_map(function ($line) {
         return $line['id'];
     }, $lines->all());
     $dateStart = new \DateTime('-4 day');
     $dateEnd = new \DateTime('+4 day');
     $tasks = Task::whereIn('line_id', $lineIds)->whereBetween('date', [$dateStart->format('Y-m-d'), $dateEnd->format('Y-m-d')])->get();
     return view('nichirei.index', ['lines' => $lines, 'tasks' => $tasks, 'dateStart' => $dateStart, 'dateEnd' => $dateEnd]);
 }
開發者ID:shatee,項目名稱:nichirei-benri,代碼行數:12,代碼來源:NichireiController.php

示例2: userTasks

 public static function userTasks()
 {
     $ids = static::current()->pluck('user_id')->unique();
     $container = collect();
     foreach ($ids as $id) {
         $subContainer = collect();
         $user = User::find($id);
         $subContainer->tasks = Task::whereIn('id', $user->currentTasks())->pluck('slug');
         $subContainer->name = $user->name;
         $container->push($subContainer);
     }
     return $container;
 }
開發者ID:PLANKandre,項目名稱:dashboard,代碼行數:13,代碼來源:WorkWheel.php

示例3: todayActivityInProgress

 /**
  * Retrieves information for volunteer's activity of the day that is in progress.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return  JSON  array of status of activity with activity
  */
 public function todayActivityInProgress(Request $request)
 {
     if ($request->get('token') != null) {
         // Get Authenticated User
         $authenticatedUser = JWTAuth::setToken($request->get('token'))->authenticate();
         $id = $authenticatedUser->volunteer_id;
         // Retrieve Activties within today
         $todayactivities = Activity::whereBetween('datetime_start', [Carbon::now()->startOfDay(), Carbon::now()->endOfDay()])->lists('activity_id');
         //echo count($todayactivities);
         // Retrieve Related Activties within today related to volunteer
         $groupStatus = collect(['pick-up', 'at check-up', 'check-up completed']);
         $relatedActivty = Task::whereIn('activity_id', $todayactivities)->where('volunteer_id', $id)->whereIn('status', $groupStatus)->lists('activity_id');
         $taskStatus = Task::whereIn('activity_id', $todayactivities)->whereIn('status', $groupStatus)->where('volunteer_id', $id)->value('status');
         // Retrieve Activity details
         $activityToReturn = Activity::with('departureCentre', 'arrivalCentre')->whereIn('activity_id', $relatedActivty)->first();
         return response()->json(compact('activityToReturn', 'taskStatus'));
     } else {
         $status = ["Missing parameter"];
         return response()->json(compact('status'));
     }
 }
開發者ID:jonnylow,項目名稱:CrowdSourcingApplicationWeb,代碼行數:27,代碼來源:VolunteerController.php


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