• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP app\Task类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: store

 public function store(Request $request, Task $task)
 {
     $task->addNote(new Note($request->all()));
     $task->setUpdatedAt(Carbon::now()->toDateTimeString());
     $task->save();
     return back();
 }
开发者ID:macewanCS,项目名称:librasoft,代码行数:7,代码来源:NotesController.php


示例2: destroy

 /**
  * Destroy the given task.
  *
  * @param  Request  $request
  * @param  Task  $task
  * @return Response
  */
 public function destroy(Request $request, Task $task)
 {
     if (\Auth::id() == $task->user_id) {
         $task->delete();
     }
     return redirect('/tasks');
 }
开发者ID:anhtt93,项目名称:BookStore,代码行数:14,代码来源:TaskController.php


示例3: pathProgress

 /**
  * checks each step of the path if it was completed (based on its timestamp).
  * also calls the findCrossingPath method to (surprise!) find the paths crossing the current path
  *
  * @param Task $task
  */
 public static function pathProgress(Task $task)
 {
     if ($task->path->isEmpty()) {
         $task->army->update(['task_id' => 0, 'path_id' => 0]);
         $task->delete();
         return;
     }
     $path = $task->path;
     self::processFoodConsumption($path);
     $finished = null;
     $path->filter(function ($item) use(&$finished) {
         if ($item->finished_at <= Carbon::now()) {
             // if the step is finished
             self::findCrossingPath($item);
             $finished = $item;
             $item->delete();
         }
     });
     // now $finished is the last element of the path.
     // $finished has the hex where the army is
     if ($finished != null) {
         $army = $task->army;
         $army->currentHex->update(['army_id' => 0]);
         $army->update(['current_hex_id' => $finished->hex_id]);
         $finished->hex->update(['army_id' => $army->id]);
     }
     if ($path->isEmpty()) {
         $task->army->update(['task_id' => 0, 'path_id' => 0]);
         $task->delete();
     }
 }
开发者ID:nadapapa,项目名称:PHP-RTS-game,代码行数:37,代码来源:ArmyController.php


示例4: create

 /**
  * Create a new task` for the given user and data.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @param  array  $data
  * @return \App\Task
  */
 public function create($user, array $data)
 {
     $task = new Task($data);
     $task->user_id = $user->id;
     $task->save();
     return $task;
 }
开发者ID:luismec90,项目名称:laravel-todo-app-best-practices,代码行数:14,代码来源:EloquentTaskRepository.php


示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $task = new Task();
     $task->name = $request->name;
     $task->user_id = $request->user_id;
     $task->save();
 }
开发者ID:JCombee,项目名称:dolphin,代码行数:13,代码来源:TaskController.php


示例6: getDelete

 public function getDelete(Task $task)
 {
     if ($task->user_id == Auth::user()->id) {
         //delete task als de juiste user is ingelogd
         $task->delete();
     }
     return Redirect::route('home');
 }
开发者ID:gurbuzhasan,项目名称:web-backend-oplossingen,代码行数:8,代码来源:PagesController.php


示例7: newtask

 public function newtask(Request $request)
 {
     $this->validate($request, ['name' => 'required|max:10']);
     $task = new Task();
     $task->name = $request->name;
     $task->save();
     return redirect('tasks');
 }
开发者ID:bg1ufp,项目名称:laravel-study,代码行数:8,代码来源:TaskController.php


示例8: createTask

 public static function createTask($input)
 {
     $task = new Task();
     $task->title = $input['title'];
     $task->complete = $input['complete'];
     $task->save();
     return $task;
 }
开发者ID:rilonx,项目名称:todo-api,代码行数:8,代码来源:Task.php


示例9: save

 public function save(Task $task, $members = null)
 {
     $task->save();
     /* Insert Task Members to Pivot Table */
     if ($members) {
         $task->syncMembers($members);
     }
     return true;
 }
开发者ID:ehomeuc,项目名称:ehome,代码行数:9,代码来源:TaskRepository.php


示例10: testSetLabelToTask

 function testSetLabelToTask()
 {
     $label = factory(\App\ProjectLabel::class)->make(['name' => "foo"]);
     $this->project->labels()->save($label);
     $this->task->label()->associate($label)->save();
     $this->assertEquals('foo', $this->task->label->name);
     $this->assertEquals(2, $this->task->activity->count());
     $this->assertEquals($label->id, $this->task->activity->get(1)->note);
 }
开发者ID:absolux,项目名称:Collabor8-php-api,代码行数:9,代码来源:TaskTest.php


示例11: seedTasks

 public function seedTasks($faker)
 {
     foreach (range(0, 100) as $number) {
         $task = new Task();
         $task->name = $faker->sentence;
         $task->done = $faker->boolean;
         $task->priority = $faker->randomDigit;
         $task->save();
     }
 }
开发者ID:albertmayor,项目名称:tasksAPI,代码行数:10,代码来源:DatabaseSeeder.php


示例12: seedTasks

 /**
  * @param Faker $faker
  */
 private function seedTasks($faker)
 {
     foreach (range(0, 100) as $item) {
         $task = new Task();
         $task->name = $faker->sentence();
         $task->done = $faker->boolean();
         $task->priority = $faker->randomDigit();
         $task->save();
     }
 }
开发者ID:Germangalia,项目名称:tasksAPI,代码行数:13,代码来源:DatabaseSeeder.php


示例13: add

 /**
  * Function for adding new user to database
  * @param Request $request [http request with data]
  * @return id [id of the task added]
  */
 public function add(Request $request)
 {
     if (Auth::check()) {
         $user_id = Auth::user()->id;
         $task = new Task();
         $task->task_name = $request->task_name;
         $task->user_id = $user_id;
         $task->save();
         return $task->id;
     }
 }
开发者ID:shile23,项目名称:laravel-todo,代码行数:16,代码来源:TasksController.php


示例14: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, Request $request)
 {
     $this->validate($request, ['title' => 'required', 'description' => 'required']);
     $input = $request->all();
     $mTask = new Task();
     $task = $mTask->getTaskById($id);
     //        dd($task->toArray());
     $task->saveTask($id, $input);
     //        Session::flash('flash_message', 'Task successfully added!');
     return redirect()->back()->with('flash_message', 'Task successfully added!');
 }
开发者ID:vudn-job,项目名称:todo-list,代码行数:17,代码来源:TasksController.php


示例15: finishTask

 /**
  * @param Task $task
  */
 public static function finishTask(Task $task)
 {
     switch ($task->type) {
         case 1:
             // create worker
             $task->building->city->human_resources->workers += 1;
             $task->building->city->human_resources->save();
             $task->delete();
             break;
         case 2:
             // create settler
             $task->building->city->human_resources->settlers += 1;
             $task->building->city->human_resources->save();
             $task->delete();
             break;
         case 3:
             // create a general
             if ($task->building->city->hex->army_id == 0) {
                 $army = Army::create(['user_id' => $task->building->city->owner, 'current_hex_id' => $task->building->city->hex->id]);
                 $task->building->city->hex->army_id = $army->id;
                 $task->building->city->hex->save();
             }
             if ($task->building->city->hex->army->general) {
                 break;
             }
             $task->building->city->hex->army->update(['general' => true]);
             $task->delete();
             break;
         case 11:
             // create unit
         // create unit
         case 12:
         case 13:
         case 14:
         case 15:
         case 16:
         case 17:
             if ($task->building->city->hex->army_id == 0) {
                 $army = Army::create(['user_id' => $task->building->city->owner, 'current_hex_id' => $task->building->city->hex->id]);
                 $task->building->city->hex->army_id = $army->id;
                 $task->building->city->hex->save();
             }
             $unit_type = 'unit' . ($task->type - 10);
             $task->building->city->hex->army->{$unit_type} += 1;
             $task->building->city->hex->army->save();
             $task->delete();
             break;
         case 20:
             // move army
             ArmyController::pathProgress($task);
             break;
     }
 }
开发者ID:nadapapa,项目名称:PHP-RTS-game,代码行数:56,代码来源:TaskController.php


示例16: post

 public function post(Request $request)
 {
     //echo "post";
     $validator = Validator::make($request->all(), ['name' => 'required|max:255']);
     if ($validator->fails()) {
         return redirect('/')->withInput()->withErrors($validator);
     }
     $task = new Task();
     $task->name = $request->name;
     $task->save();
     //print_r($request->name);
     return redirect('/');
 }
开发者ID:Anton-Patokin,项目名称:web-backend-oplossingen,代码行数:13,代码来源:TodoController.php


示例17: update

 public function update($taskID, TaskRequest $request)
 {
     $task = Task::findOrNew($taskID);
     $task->taskName = $request->taskName;
     $task->save();
     return view('edit', ['task' => $task]);
 }
开发者ID:phongln,项目名称:laravel5,代码行数:7,代码来源:TaskController.php


示例18: destroy

 public function destroy($id)
 {
     $task = Task::findOrFail($id);
     $task->delete();
     \Session::flash('flash_message', 'Tarea borrada');
     return redirect()->route('tasks.index');
 }
开发者ID:JuanVqz,项目名称:crud5,代码行数:7,代码来源:TasksController.php


示例19: destroy

 public function destroy($id)
 {
     $response = Task::find($id)->delete();
     if ($response) {
         return redirect('/');
     }
 }
开发者ID:nayem73cse12,项目名称:Laravel_first_CRUD,代码行数:7,代码来源:TodoController.php


示例20: markComplete

 public function markComplete($taskId)
 {
     $task = Task::find($taskId);
     $task->completed = true;
     $task->save();
     return redirect()->route('tasks');
 }
开发者ID:leejunkit,项目名称:vashti,代码行数:7,代码来源:HomeController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP app\Team类代码示例发布时间:2022-05-23
下一篇:
PHP app\Tag类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap