當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。