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


PHP Task::create方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $validation = Validator::make($input, Task::$rules);
     if ($validation->passes()) {
         $this->task->create($input);
         Queue::push(function ($job) {
             Log::info('Do something when task is created.');
             $job->delete();
         });
         return Redirect::route('tasks.index');
     }
     return Redirect::route('tasks.create')->withInput()->withErrors($validation)->with('message', 'There were validation errors.');
 }
开发者ID:aletuan,项目名称:forge-demo,代码行数:19,代码来源:TasksController.php

示例2: handleRequest

 protected function handleRequest(array $request)
 {
     $listId = $request[self::FIELD_LIST_ID];
     $title = $request[self::FIELD_TITLE];
     $description = $request[self::FIELD_DESCRIPTION];
     $beforeId = $request[self::FIELD_BEFORE_TASK_ID];
     if (isset($request[self::FIELD_AFTER_LAST_OPEN])) {
         if ($request[self::FIELD_AFTER_LAST_OPEN]) {
             $beforeId = Task::findNextTaskIdAfterLastOpenTask($listId);
         }
     }
     TasksList::lock($listId);
     $ord = null;
     if ($beforeId) {
         $beforeTask = Task::fetch($beforeId);
         if ($beforeTask->getListId() !== $listId) {
             throw new Exception("Insertion point for a new task is in another list", EndPoint::STATUS_BAD_REQUEST);
         }
         $ord = $beforeTask->getOrd();
         Task::shiftRight($listId, $ord);
     } else {
         $ord = Task::getNextOrd($listId);
     }
     $taskId = Task::create($listId, $ord, $title, $description);
     return array(self::FIELD_TASK_ID => $taskId);
 }
开发者ID:gmaizel,项目名称:taskdimension,代码行数:26,代码来源:create.php

示例3: saveItem

 /**
  * (non-PHPdoc)
  * @see DetailsPageAbstract::saveItem()
  */
 public function saveItem($sender, $param)
 {
     $results = $errors = array();
     try {
         Dao::beginTransaction();
         $task = null;
         if (isset($param->CallbackParameter->id) && !($task = Task::get(trim($param->CallbackParameter->id))) instanceof Task) {
             throw new Exception('Invalid Task passed in!');
         }
         if (!isset($param->CallbackParameter->instructions) || ($instructions = trim($param->CallbackParameter->instructions)) === '') {
             throw new Exception('Instructions are required!');
         }
         if (!isset($param->CallbackParameter->customerId) || !($customer = Customer::get(trim($param->CallbackParameter->customerId))) instanceof Customer) {
             throw new Exception('Invalid Customer Passed in!');
         }
         $tech = isset($param->CallbackParameter->techId) ? UserAccount::get(trim($param->CallbackParameter->techId)) : null;
         $order = isset($param->CallbackParameter->orderId) ? Order::get(trim($param->CallbackParameter->orderId)) : null;
         $dueDate = new UDate(trim($param->CallbackParameter->dueDate));
         $status = isset($param->CallbackParameter->statusId) ? TaskStatus::get(trim($param->CallbackParameter->statusId)) : null;
         if (!$task instanceof Task) {
             $task = Task::create($customer, $dueDate, $instructions, $tech, $order);
         } else {
             $task->setCustomer($customer)->setDueDate($dueDate)->setInstructions($instructions)->setTechnician($tech)->setFromEntityId($order instanceof Order ? $order->getId() : '')->setFromEntityName($order instanceof Order ? get_class($order) : '')->setStatus($status)->save();
         }
         // 			$results['url'] = '/task/' . $task->getId() . '.html?' . $_SERVER['QUERY_STRING'];
         $results['item'] = $task->getJson();
         Dao::commitTransaction();
     } catch (Exception $ex) {
         Dao::rollbackTransaction();
         $errors[] = $ex->getMessage();
     }
     $param->ResponseData = StringUtilsAbstract::getJson($results, $errors);
 }
开发者ID:larryu,项目名称:magento-b2b,代码行数:37,代码来源:Controller.php

示例4: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Task::create([]);
     }
 }
开发者ID:sahilkathpal,项目名称:hackcoin,代码行数:7,代码来源:TasksTableSeeder.php

示例5: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 100) as $index) {
         Task::create(['name' => $faker->text(10, 20), 'description' => $faker->text(140)]);
     }
 }
开发者ID:anildukkipatty,项目名称:maurice-tool-laravel,代码行数:7,代码来源:TasksTableSeeder.php

示例6: handleRequest

 protected function handleRequest(array $request)
 {
     $version = $request[self::FIELD_PROTOCOL_VERSION];
     $projectTitle = $request[self::FIELD_TITLE];
     $projectDescription = $request[self::FIELD_DESCRIPTION];
     $projectId = Project::create(Project::getNextOrd(), $projectTitle, $projectDescription);
     $listsRep = $request[self::FIELD_LISTS];
     $listOrd = 0;
     foreach ($listsRep as $listRep) {
         $listTitle = $listRep[self::FIELD_TITLE];
         $listId = TasksList::create($projectId, ++$listOrd, $listTitle);
         $tasksRep = $listRep[self::FIELD_TASKS];
         $taskOrd = 0;
         foreach ($tasksRep as $taskRep) {
             $taskTitle = $taskRep[self::FIELD_TITLE];
             $taskDescription = $taskRep[self::FIELD_DESCRIPTION];
             $taskId = Task::create($listId, ++$taskOrd, $taskTitle, $taskDescription);
             if ($version > 1) {
                 $taskStatus = $taskRep[self::FIELD_TASK_STATUS];
                 Task::updateStatus($taskId, $taskStatus);
             }
         }
     }
     return array(self::FIELD_PROJECT_ID => $projectId);
 }
开发者ID:gmaizel,项目名称:taskdimension,代码行数:25,代码来源:import.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Project $project, Request $request)
 {
     $this->validate($request, $this->rules);
     $input = Input::all();
     $input['project_id'] = $project->id;
     Task::create($input);
     return Redirect::route('projects.show', $project->slug)->with('message', 'Task created.');
 }
开发者ID:Codenado,项目名称:tado,代码行数:13,代码来源:TasksController.php

示例8: store

 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required', 'description' => 'required']);
     $input = $request->all();
     Task::create($input);
     Session::flash('flash_message', 'Task successfully added!');
     return redirect()->back();
 }
开发者ID:gokulraja01,项目名称:Test,代码行数:8,代码来源:TasksController.php

示例9: run

 public function run()
 {
     Model::unguard();
     $times = 5;
     for ($i = 0; $i < $times; $i++) {
         Task::create(array('name' => Str::random(), 'active' => rand(0, 1)));
     }
 }
开发者ID:devchd,项目名称:todo,代码行数:8,代码来源:TasksSeeder.php

示例10: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Eloquent::unguard();
     // $this->call('UserTableSeeder');
     DB::table('users')->truncate();
     User::create(['username' => 'Sampler', 'email' => 'sample@kanban.list', 'password' => 'sample', 'password_confirmation' => 'sample', 'confirmed' => true]);
     DB::table('tasks')->truncate();
     Task::create(['user_id' => 1, 'book_id' => 1, 'order_no' => 1, 'status' => 1, 'name' => 'sample_name', 'message' => 'sample_message', 'doing_at' => 'now()', 'pomo' => 1]);
 }
开发者ID:neilmillard,项目名称:kanbanlist,代码行数:14,代码来源:DatabaseSeeder.php

示例11: create

 public function create()
 {
     Log::debug(__METHOD__);
     //		Log::debug(print_r(Input::all(), true));
     $task = Task::create(['user_id' => Auth::user()->id, 'book_id' => Book::getIdInMessage(Auth::user(), Input::get('message')), 'status' => Task::$status_table[Input::get('priority', 'todo_m')], 'name' => Auth::user()->username, 'message' => Input::get('message')]);
     $moveId = $this->isMovedFromBook($task) ? $task->id : 0;
     $taskHtml = View::make('tasks._task')->with(['task' => $task, 'display' => 'none', 'done' => false])->render();
     return Response::json(['id' => $task->id, 'status' => $task->statusSymbol(), 'li_html' => $taskHtml, 'move_task_id' => $moveId, 'task_counts' => $this->getTaskCounts(), 'all_books' => $this->getAllBookCounts()])->setCallback('addTodoResponse');
 }
开发者ID:neilmillard,项目名称:kanbanlist,代码行数:9,代码来源:TasksController.php

示例12: store

 /**
  * Store a newly created resource in storage.
  * POST /tasks
  *
  * @return Response
  */
 public function store()
 {
     $tasks = Task::create(Input::all());
     if ($tasks) {
         return ['status' => true, 'data' => $tasks];
     } else {
         return ['status' => false];
     }
 }
开发者ID:anildukkipatty,项目名称:maurice-tool-laravel,代码行数:15,代码来源:TasksController.php

示例13: store

 public function store()
 {
     //add the task
     if (!Task::taskIsValid(Input::all())) {
         return Redirect::back()->withInput()->withErrors(Task::$errors);
     }
     $addTasks = Task::create(Input::all());
     $addTasks->complaint = 'No complaints so far.';
     $addTasks->save();
     return Redirect::route('tasks.index');
 }
开发者ID:gerry411,项目名称:MatasTasklist,代码行数:11,代码来源:TasksController.php

示例14: index

 public function index()
 {
     $task = new Task();
     $task->text = 'Tar';
     $task->duedate = new Date();
     $task->checkb = '0';
     $result = $task->create();
     if (!$result) {
         throw new Exception('Error al insertar registro.');
     }
 }
开发者ID:ComfamiliarCurso2,项目名称:ClaseInicial,代码行数:11,代码来源:index_controller.php

示例15: run

 public function run()
 {
     Task::truncate();
     $faker = Faker::create();
     foreach (range(1, 100) as $index) {
         $numb = array(1, 2, 3, 4);
         $numbs = array(1, 2);
         $nums = $numbs[array_rand($numbs)];
         $num = $numb[array_rand($numb)];
         Task::create(['title' => $faker->sentence, 'description' => $faker->paragraph(3), 'category_id' => $nums, 'employee_id' => $num, 'complaint' => 'No complaints so far.']);
     }
 }
开发者ID:gerry411,项目名称:MatasTasklist,代码行数:12,代码来源:TasksTableSeeder.php


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