当前位置: 首页>>代码示例>>PHP>>正文


PHP Task::where方法代码示例

本文整理汇总了PHP中app\Task::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::where方法的具体用法?PHP Task::where怎么用?PHP Task::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Task的用法示例。


在下文中一共展示了Task::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getTaskInfo

 /**
  * 返回基本信息
  * @param $id
  */
 public static function getTaskInfo($id)
 {
     $model = Task::where("id", $id)->get();
     $att_arr = $model[0]->attributes;
     unset($att_arr['id']);
     return $att_arr;
 }
开发者ID:diandianxiyu,项目名称:LaravelApi,代码行数:11,代码来源:Task.php

示例2: put

 public function put($done, Task $task)
 {
     //echo $done."<br>";
     //var_dump($task);
     //echo "hallo";
     //var_dump($request-done);
     //echo $done ."<br>";
     //var_dump($task->id);
     //echo $task->id;
     //$task->done();
     //$task->done($done);
     //var_dump($task->done);
     //echo "hallo";
     //Task->done($task-id) = $request->name;
     //$numberOfDone = Task::findOrFail($task->id)->done(1);
     //$numberOfDone = Task::update(array('done' => 1));
     //echo $numberOfDone;
     //Task::findOrFail($task->id)->done->save();
     //var_dump($taskss);
     //var_dump(Task->done;
     //echo "hallo";
     /*
            $taskssss = Task::where('user_id', $request->user()->id)->get();
      foreach ($taskssss as $task){
          echo $task->done;
      }
     */
     //return redirect('/tasks');
     Task::where('id', $task->id)->update(['done' => $done]);
     return redirect('/tasks');
 }
开发者ID:Anton-Patokin,项目名称:web-backend-oplossingen,代码行数:31,代码来源:TaskController.php

示例3: index

 /**
  * ユーザーの全タスクをリスト表示
  *
  * @param  Request  $request
  * @return Response
  */
 public function index(Request $request)
 {
     #$tasks = Task::where('user_id', $request->user()->id)->get();
     // ページネーション
     $tasks = Task::where('user_id', $request->user()->id)->paginate(3);
     return view('tasks.index', ['tasks' => $tasks]);
 }
开发者ID:ryamamoto,项目名称:laravel5-sample-tasklist,代码行数:13,代码来源:TaskController.php

示例4: search

 public function search(Request $request)
 {
     $results = array();
     $term = $request->get('term');
     $goals = Goal::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $objectives = Objective::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $actions = Action::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $tasks = Task::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $teams = Team::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get();
     $departments = Department::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get();
     $users = User::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get()->all();
     foreach (User::where('email', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get() as $matching_user_email) {
         if (in_array($matching_user_email, $users)) {
             continue;
         }
         $users[] = $matching_user_email;
     }
     $notes = Note::where('content', 'like', '%' . $term . '%')->orderBy('content', 'asc')->get();
     $types = [$goals, $objectives, $actions, $tasks, $teams, $departments, $users, $notes];
     foreach ($types as $type) {
         foreach ($type as $result) {
             $results[] = $result;
         }
     }
     return view('search.show')->with('results', $results)->with('term', $term);
 }
开发者ID:macewanCS,项目名称:librasoft,代码行数:26,代码来源:SearchController.php

示例5: checkTasks

 public static function checkTasks()
 {
     $finished_tasks = Task::where('finished_at', '<=', Carbon::now())->orWhere('type', 20)->orderBy('finished_at', 'asc')->get();
     $finished_tasks->each(function ($task) {
         self::finishTask($task);
     });
 }
开发者ID:nadapapa,项目名称:PHP-RTS-game,代码行数:7,代码来源:TaskController.php

示例6: show

 /**
  * Display the specified resource.
  *
  * @param $timeCardHoursWorkedId
  *
  * @return \Illuminate\Http\Response|\Illuminate\View\View
  */
 public function show($timeCardHoursWorkedId)
 {
     // set appGlobal.clientId to current view, otherwise 'if (appGlobal.clientId)' in TimeCard.js causes a js load failure.
     appGlobals::populateJsGlobalClient();
     // used for routing.
     appGlobals::setSessionVariableAppGlobalTimeCardTableName($timeCardHoursWorkedId);
     // get all task for a specific time_card.date.
     /* @noinspection PhpUndefinedMethodInspection */
     $tasks = Task::where('time_card_hours_worked_id', '=', $timeCardHoursWorkedId)->get()->sortBy('start_time');
     // derive total hours worked.
     $totalHoursWorked = 0;
     foreach ($tasks as $task) {
         $totalHoursWorked += $task->hours_worked;
     }
     // eager load task_type for each task.
     /* @noinspection PhpUndefinedMethodInspection */
     $tasks->load('taskType');
     // get time_card data.
     /* @noinspection PhpUndefinedMethodInspection */
     $timeCard = TimeCardHoursWorked::where('id', '=', $timeCardHoursWorkedId)->get();
     // check if $timeCardHoursWorkedId exists, if not return 404 message.
     if (count($timeCard) == 0) {
         abort(404, 'Your Task ID does not exist.');
     }
     // pass the data to the view.
     return view('pages.userTaskView')->with('tasks', $tasks)->with('timeCard', $timeCard)->with('timeCardHoursWorkedId', $timeCardHoursWorkedId)->with('totalHoursWorked', $totalHoursWorked);
 }
开发者ID:RichJones22,项目名称:TimeTrax,代码行数:34,代码来源:TaskController.php

示例7: postDeleteComplete

 public function postDeleteComplete(Request $request)
 {
     $tasks = \App\Task::where('list_id', $request->list_id)->where('complete', 1)->get();
     foreach ($tasks as $task) {
         $task->delete();
     }
 }
开发者ID:ahuggins,项目名称:taskr,代码行数:7,代码来源:TaskController.php

示例8: postTask

 function postTask(Request $request)
 {
     $task = $request->all();
     Task::create($task);
     $comm = Committee::where('id', $task['comm_id'])->first();
     $evnt = Event::where('id', $comm['event_id'])->first();
     //UPDATING WEIGHT OF COMMITTEE AND EVENT
     $comm->increment('weight', $task['weight']);
     $evnt->increment('weight', $task['weight']);
     //UPDATING PROGRESS OF COMMITTEE
     $progress = 0;
     $tasks = Task::where('comm_id', $comm->id)->get();
     foreach ($tasks as $task1) {
         $progress += $task1->weight * $task1->progress;
     }
     $progress = $progress / $comm->weight;
     $comm->progress = $progress;
     $comm->save();
     //UPDATING PROGRESS OF EVENT
     $progress2 = 0;
     $committees = Committee::all();
     foreach ($committees as $committee) {
         if ($committee->event_id == $evnt->id) {
             $progress2 += $committee->weight * $committee->progress;
         }
     }
     $progress2 = $progress2 / $evnt->weight;
     $evnt->progress = $progress2;
     $evnt->save();
     return redirect('profile');
 }
开发者ID:zoekayvee,项目名称:YSESTracker,代码行数:31,代码来源:TaskController.php

示例9: index

 public function index(Request $request)
 {
     echo "hallo controller tasks";
     //return view('tasks.index');
     $tasks = Task::where('user_id', $request->user()->id)->get();
     //hier waren verkeerde variabelen doorgegeven.
     return view('tasks.index', ['tasks' => $tasks]);
 }
开发者ID:Anton-Patokin,项目名称:web-backend-oplossingen,代码行数:8,代码来源:TaskController.php

示例10: findByUser

 /**
  * new query to find all user's tasks
  * @param  [type] $id [description]
  * @return [type]     [description]
  */
 public static function findByUser($id)
 {
     $task = Task::where('id', $id)->where('user_id', Auth::id())->first();
     if (!$task) {
         throw new ModelNotFoundException();
     }
     return $task;
 }
开发者ID:kmassada,项目名称:laravel-angular,代码行数:13,代码来源:Task.php

示例11: clearComplete

 public function clearComplete()
 {
     $tasks = \App\Task::where('is_complete', true)->get();
     foreach ($tasks as $task) {
         $task->delete();
     }
     return redirect('/');
 }
开发者ID:neon670,项目名称:php-lumen-sample,代码行数:8,代码来源:TaskController.php

示例12: checkIfEndTimeOverLaps

 public function checkIfEndTimeOverLaps($timeCardId, $endTime)
 {
     $val = Task::where('time_card_hours_worked_id', '=', $timeCardId)->where('start_time', '<', $endTime)->where('end_time', '>=', $endTime)->first();
     if (is_null($val)) {
         return false;
     }
     return true;
 }
开发者ID:RichJones22,项目名称:TimeTrax,代码行数:8,代码来源:Task.php

示例13: getWhitelist

 public static function getWhitelist($user, $tasks)
 {
     $whitelist = $tasks->diff($user->taskExemptions->pluck('task_id'));
     if (($bad = Task::where('slug', 'recycling')->first()->id) && $tasks->contains($bad) && !$user->canDoRecycling()) {
         $whitelist->pull($whitelist->search($bad));
     }
     return $whitelist;
 }
开发者ID:PLANKandre,项目名称:dashboard,代码行数:8,代码来源:WorkWheel.php

示例14: delete

 public function delete($id)
 {
     TaskModel::where('project_id', $id)->delete();
     ProjectModel::where('id', $id)->delete();
     $alert['msg'] = 'Project has been deleted successfully';
     $alert['type'] = 'success';
     return Redirect::route('project')->with('alert', $alert);
 }
开发者ID:michaelotto126,项目名称:shokes,代码行数:8,代码来源:ProjectController.php

示例15: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $statuses = [];
     foreach (Status::paginate() as $status) {
         $statuses[$status->id] = $status->name;
     }
     $data = ['tasks' => Task::where('user_id', $request->user()->id)->paginate(), 'statuses' => Status::paginate()];
     return view('task.index')->with($data);
 }
开发者ID:nballener,项目名称:omgwhatsnext,代码行数:14,代码来源:TaskController.php


注:本文中的app\Task::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。