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


PHP Task::where方法代码示例

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


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

示例1: view

 function view($id = null)
 {
     if (is_null($id)) {
         echo "error: no id supplied";
         return false;
     }
     $this->load->library('bitly');
     $this->form_validation->set_rules('name', 'Task Name', 'required|trim');
     $data = array();
     $docket = new Docket();
     $task = new Task();
     $user = new User();
     if (!$docket->where('shared', 1)->where('id', $id)->count()) {
         redirect('dockets');
     } else {
         $data['docket'] = $docket->get_by_id($id);
     }
     if ($docket->short_url == '') {
         $docket->short_url = $this->bitly->shorten(base_url() . 'index.php/pub/view/' . $docket->id);
         $docket->save();
     }
     if ($task->where('completed', 0)->where_related_docket('id', $docket->id)->count() == 0) {
         $data['pending_tasks'] = array();
     } else {
         $data['pending_tasks'] = $task->where('completed', 0)->where_related_docket('id', $docket->id)->get()->all;
     }
     if ($task->where('completed', 1)->where_related_docket('id', $docket->id)->count() == 0) {
         $data['completed_tasks'] = array();
     } else {
         $data['completed_tasks'] = $task->where('completed', 1)->where_related_docket('id', $docket->id)->get()->all;
     }
     $data['user'] = $user->get_by_id($docket->user_id);
     $this->load->view('pub/view', $data);
 }
开发者ID:narendranag,项目名称:dockets,代码行数:34,代码来源:pub.php

示例2: User

 function uncomplete_task()
 {
     $id = $this->input->post('id');
     $user = new User();
     $task = new Task();
     if ($task->where('user_id', $this->dx_auth->get_user_id())->where('id', $id)->count() == 0) {
         return;
     }
     $task->get_by_id($id);
     $task->completed = 0;
     $task->save();
     $docket = new Docket();
     $docket->get_by_id($task->docket_id);
     $task->clear();
     if ($task->where('docket_id', $docket->id)->where('completed', 0)->count() == 0) {
         $docket->completed = 1;
         $docket->save();
     } else {
         $docket->completed = 0;
         $docket->save();
     }
     $gold = $this->treasure->decrease($this->dx_auth->get_user_id());
     $task->clear();
     $task->get_by_id($id);
     $result = array('id' => $task->id, 'name' => $task->name, 'docket_id' => $docket->id, 'gold' => $gold);
     echo json_encode($result);
 }
开发者ID:narendranag,项目名称:dockets,代码行数:27,代码来源:ajax.php

示例3: update

 /**
  * Update the specified resource in storage.
  * PUT /tasks/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $tasks = Task::where('id', $id)->update(Input::all());
     if ($tasks) {
         return ['status' => true, 'data' => $tasks];
     } else {
         return ['status' => false];
     }
 }
开发者ID:anildukkipatty,项目名称:maurice-tool-laravel,代码行数:16,代码来源:TasksController.php

示例4: update

 /**
  * Update the specified resource in storage.
  * PUT /tasks/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $task = Task::where('id', $id)->update(Input::all());
     if ($task) {
         $data = Task::find($id);
         return ['status' => true, 'data' => $data];
     } else {
         return ['status' => false];
     }
 }
开发者ID:sahilkathpal,项目名称:hackcoin,代码行数:17,代码来源:TasksController.php

示例5: add

 public function add()
 {
     $this->load->library('jdf');
     $this->load->helper('form');
     $this->load->library('form_validation');
     $this->load->library("session");
     if ($this->form_validation->run('item/add') === FALSE) {
         $this->load->view("templates/errorForm.php", array("fields" => array('rating', 'isDone', 'task', 'date', 'endTime', 'startTime')));
     } else {
         $item = new Item();
         $task = new Task();
         $user = new User($this->session->getStudentId());
         if ($this->input->post("isDone") == 1) {
             $state = ITEM_STATE_DONE;
         } else {
             $state = ITEM_STATE_UNDONE;
         }
         $task->where("user_id", $this->session->getStudentId());
         $task->where("id", $this->input->post("task"));
         $start = makeTime($this->input->post("date"), $this->input->post("startTime"));
         $end = makeTime($this->input->post("date"), $this->input->post("endTime"));
         try {
             $task->get();
             $item->create($start, $end, $this->input->post("description"), $state, $this->input->post("rating"))->save($user, $task);
             $this->load->view("item/item_created.php", array("item" => $this->setFormat(array($item))));
         } catch (Item_Overlap_With_Other_Item $e) {
             $this->load->view("item/item_error.php");
             Item_Error::Item_Overlap_With_Other_Item();
         } catch (Item_Create_With_Zero_Duration $e) {
             $this->load->view("item/item_error.php");
             Item_Error::Item_Create_With_Zero_Duration();
         } catch (Item_Feedback_Wrong $e) {
             $this->load->view("item/item_error.php");
             Item_Error::Item_Feedback_Wrong();
         } catch (Item_Start_Greater_Than_End_Exception $e) {
             $this->load->view("item/item_error.php");
             Item_Error::Item_Start_Greater_Than_End_Exception();
         } catch (Task_Not_Found $e) {
             $this->load->view("task/task_error.php");
         }
     }
 }
开发者ID:rezachess,项目名称:Planning,代码行数:42,代码来源:Item_controller.php

示例6: destroy

 /**
  * Remove the specified resource from storage.
  * DELETE /users/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // Delete everything related to the user
     Task::where('user_id', Auth::id())->delete();
     Credential::where('user_id', Auth::id())->delete();
     Project::where('user_id', Auth::id())->delete();
     Client::where('user_id', Auth::id())->delete();
     User::where('id', Auth::id())->delete();
     // Logout and redirect back to home page
     Auth::logout();
     return Redirect::to('/');
 }
开发者ID:siparker,项目名称:ribbbon,代码行数:19,代码来源:UsersController.php

示例7: complete

 public function complete($id)
 {
     $date = time();
     $task = Task::find($id);
     $task->done_at = $date;
     $task->isDone = 1;
     $task->save();
     $tache = Task::where('id', '=', $id)->get();
     $titre = $tache[0]->title;
     Session::flash('completed', "La tâche <em>{$titre}</em> a bien été complété.");
     return Redirect::to(URL::previous());
 }
开发者ID:Yoan-Philippe,项目名称:tasks,代码行数:12,代码来源:HomeController.php

示例8: search

 /**
  * Run a general search.
  * @return  array of objects with the search results.
  */
 public function search()
 {
     $q = Input::get("q");
     // redirect user back if nothing was typed
     if (empty(trim($q))) {
         return Redirect::back();
     }
     $clients = Client::where('name', 'like', '%' . $q . '%')->whereUserId(Auth::id())->get();
     $projects = Project::where('name', 'like', '%' . $q . '%')->whereUserId(Auth::id())->get();
     $tasks = Task::where('name', 'like', '%' . $q . '%')->whereUserId(Auth::id())->get();
     $pTitle = "Search Results";
     return View::make('search', compact('q', 'clients', 'projects', 'tasks', 'pTitle'));
 }
开发者ID:sakshika,项目名称:ATM,代码行数:17,代码来源:HomeController.php

示例9: storage

 public function storage()
 {
     $user_id = 2;
     if (Task::where('user_id', $user_id)->count()) {
         $task = Task::where('user_id', $user_id)->first();
     } else {
         $task = new Task();
     }
     $task->user_id = $user_id;
     $task->tasks = json_encode($_POST);
     $task->save();
     exit;
 }
开发者ID:im286er,项目名称:KillTYZ,代码行数:13,代码来源:HomeController.php

示例10: checkExist

 private function checkExist($user, $name)
 {
     $task = new Task();
     /**
      * midoonam ridam to in ghete code !!!
      */
     try {
         $task->where(array("name" => $name))->get_by_related($user);
         //            echo $task->check_last_query();
         throw new Task_Whit_This_Name_Already_Exist();
     } catch (Task_Not_Found $e) {
     }
 }
开发者ID:rezachess,项目名称:Planning,代码行数:13,代码来源:task.php

示例11: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (Input::get('searchTitle') || Input::get('searchDescription') || Input::get('searchComplaint')) {
         $searchComplaint = Input::get('searchComplaint');
         $searchTitle = Input::get('searchTitle');
         $searchDescription = Input::get('searchDescription');
         $complaint = Task::where('complaint', 'NOT LIKE', "No complaints so far.")->where(function ($query) use($searchTitle, $searchDescription, $searchComplaint) {
             $query->where('title', 'LIKE', "%{$searchTitle}%")->where('complaint', 'LIKE', "%{$searchComplaint}%")->where('description', 'LIKE', "%{$searchDescription}%");
         })->paginate(5);
         return View::make('complaints.complaint', ['tasks' => $complaint]);
     }
     $complaint = Task::where('complaint', 'NOT LIKE', "No complaints so far.")->paginate(5);
     return View::make('complaints.complaint', ['tasks' => $complaint]);
 }
开发者ID:gerry411,项目名称:MatasTasklist,代码行数:19,代码来源:ComplaintsController.php

示例12: viewEdit

 public function viewEdit($id)
 {
     $id = $id;
     $user = Auth::user()->id;
     $tache = Task::where('id', $id)->where('user_id', $user)->get();
     if ($tache->isEmpty()) {
         return redirect('/list')->with('flash_message_bad', 'Ceci n\'est pas votre tache');
     } else {
         return view('/update', compact('id'));
     }
     if ($id == 0 || $id == "") {
         return view('errorUrl');
     }
 }
开发者ID:jay44913,项目名称:todo,代码行数:14,代码来源:taskController.php

示例13: getTask

 private function getTask($id)
 {
     $this->load->library("session");
     $task = new Task();
     $whereArr = array();
     if ($id != "all") {
         $whereArr["id"] = $id;
     }
     $whereArr["user_id"] = $this->session->getStudentId();
     $task->where($whereArr)->get();
     $tasks = array();
     /** @var Task $t */
     foreach ($task as $t) {
         $tasks[] = array("id" => $t->getId(), "name" => $t->getName(), "color" => $t->getColor());
     }
     return $tasks;
 }
开发者ID:rezachess,项目名称:Planning,代码行数:17,代码来源:Task_controller.php

示例14: show

 public function show()
 {
     //show my tasks page
     if (Auth::check()) {
         $id = Auth::user()->id;
         if (Input::has('search')) {
             $search = Input::get('search');
             $taskIds = Task::where('employee_id', '=', $id)->where(function ($query) use($search) {
                 $query->where('description', 'LIKE', "%{$search}%")->orwhere('title', 'LIKE', "%{$search}%");
             })->paginate(5);
             return View::make('tasks.userTasks', ['taskIds' => $taskIds]);
         }
         $taskIds = Task::where('employee_id', '=', $id)->paginate(5);
         return View::make('tasks.userTasks', ['taskIds' => $taskIds]);
     }
     return View::make('home.home');
 }
开发者ID:gerry411,项目名称:MatasTasklist,代码行数:17,代码来源:TasksController.php

示例15: atom

 function atom($id)
 {
     if ($id == '') {
         echo 'No Feed exists at this address';
         return;
     }
     $docket = new Docket();
     $task = new Task();
     $user = new User();
     $data['docket'] = $docket->get_by_id($id);
     if ($docket->shared == 0) {
         echo 'No Feed exists at this address';
         return;
     }
     $data['tasks'] = $task->where('docket_id', $docket->id)->get()->all;
     $data['author_name'] = $user->get_by_id($docket->user_id);
     $this->load->view('feed/atom', $data);
 }
开发者ID:narendranag,项目名称:dockets,代码行数:18,代码来源:feed.php


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