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


PHP Task::create方法代码示例

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


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

示例1: 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

示例2: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     for ($i = 0; $i < 10; $i++) {
         $j = rand(0, 1000);
         Task::create(['author' => 'Testowy Autor ' . $j, 'name' => 'Testowe Zadanie ' . $j, 'category_id' => 1, 'user_id' => 1]);
     }
 }
开发者ID:mikolajszczepanski,项目名称:NuPtr,代码行数:12,代码来源:TasksTableSeeder.php

示例3: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 30) as $index) {
         Task::create(['user_id' => '1', 'title' => $faker->sentence(4), 'content' => $faker->paragraphs(8, true), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), 'due_at' => $faker->dateTimeBetween('+1 days', '+2 years')->format('m/d/Y')]);
     }
 }
开发者ID:vowsdesrat,项目名称:laravel,代码行数:12,代码来源:TasksTableSeeder.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $arrRet = array('success' => false);
     if (empty($request->get('title'))) {
         $arrRet['errors'][] = "The title cannot be empty.";
     }
     if (empty($request->get('description'))) {
         $arrRet['errors'][] = "The description cannot be empty.";
     }
     if (empty($request->get('categoryId'))) {
         $arrRet['errors'][] = "Please select a category.";
     }
     if (empty($request->get('userId'))) {
         $arrRet['errors'][] = "Please assign the task to a user.";
     }
     if (empty($arrRet['errors'])) {
         // We are good no errors
         $task = new Task();
         $created = $task->create(['title' => $request->get('title'), 'description' => $request->get('description'), 'category_id' => $request->get('categoryId'), 'user_id' => $request->get('userId')]);
         if ($created) {
             $arrRet['success'] = true;
             $arrRet['task'] = $created;
         }
     }
     return response()->json($arrRet);
 }
开发者ID:tanko2224,项目名称:envoy-todo-list,代码行数:33,代码来源:TaskController.php

示例5: store

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

示例6: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 20) as $index) {
         Task::create(['user_id' => rand(1, 4), 'title' => implode($faker->sentences(2)), 'priority_id' => rand(1, 4), 'notes' => implode($faker->paragraphs(4))]);
     }
 }
开发者ID:kmassada,项目名称:laravel-angular,代码行数:12,代码来源:TasksTableSeeder.php

示例7: store

 public function store(CreateTaskRequest $request)
 {
     $data = ['work' => Input::get('workName'), 'status' => 'Incomplete'];
     $response = Task::create($data);
     if ($response) {
         return redirect()->back();
     }
 }
开发者ID:nayem73cse12,项目名称:Laravel_first_CRUD,代码行数:8,代码来源:TodoController.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', 'Tarea agregada');
     return redirect()->back();
 }
开发者ID:JuanVqz,项目名称:crud5,代码行数:8,代码来源:TasksController.php

示例9: store

 public function store(CreateTask $request)
 {
     //dd($request->all());
     Task::create($request->all());
     return redirect('todolist');
     // var_dump($request::all());
     // Task::create($request::all());
 }
开发者ID:piyushpk89,项目名称:MasteringLaravelCode_by_Christopher_John,代码行数:8,代码来源:TasksController.php

示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['tar_title' => 'required', 'tar_descripcion' => 'required']);
     $input = $request->all();
     Task::create($input);
     $request->session()->flash('flash_message', 'Se agrego la Tarea!');
     return redirect()->back();
 }
开发者ID:akrz,项目名称:ejemploTareas,代码行数:14,代码来源:TasksController.php

示例11: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required', 'description' => 'required']);
     $input = $request->all();
     Task::create($input);
     Session::flash('flash_message', 'Задача успешно добавлена!');
     return redirect()->back();
 }
开发者ID:GanjaGanja,项目名称:crud,代码行数:14,代码来源:TasksController.php

示例12: store

 /**
  * Store a newly created resource in storage.
  *  @return \Illuminate\Http\Response
  */
 public function store()
 {
     if (!Input::get('name') or !Input::get('done') or !Input::get('priority')) {
         return $this->setStatusCode(IlluminateResponse::HTTP_UNPROCESSABLE_ENTITY)->respondWithError('Parameters failed validation for a task.');
     }
     Task::create(Input::all());
     return $this->respondCreated('Task successfully created.');
 }
开发者ID:Germangalia,项目名称:tasksAPI,代码行数:12,代码来源:TaskController.php

示例13: postCreateTask

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function postCreateTask(Request $request)
 {
     $task['content'] = $request->get('content');
     $task['user_id'] = Auth::user()->id;
     $task['list_id'] = $request->get('list_id');
     $task['complete'] = 0;
     return \App\Task::create($task);
 }
开发者ID:ahuggins,项目名称:taskr,代码行数:14,代码来源:TaskController.php

示例14: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     if ($task = Task::create($request->all())) {
         return $task->toJson();
     } else {
         return $this->response->error('Task could not be created.', 404);
     }
 }
开发者ID:sax69sax,项目名称:task-manager-api,代码行数:14,代码来源:TasksController.php

示例15: store

 public function store($todolist_id)
 {
     $name = Input::get('name');
     $completed = Input::get('completed');
     Task::create(array('todolist_id' => $todolist_id, 'name' => $name, 'completed' => $completed));
     $id = DB::table('tasks')->where('name', '=', $name)->pluck('id');
     return Response::json(['name' => $name, 'id' => $id, 'completed' => $completed, 'todolist_id' => $todolist_id]);
 }
开发者ID:brendamrl816,项目名称:gm-planner,代码行数:8,代码来源:TasksController.php


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