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


PHP Task::save方法代码示例

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


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

示例1: testSetTaskAssignedUser

 function testSetTaskAssignedUser()
 {
     $user = factory(User::class)->create(['name' => "simo"]);
     $this->task->assignee()->associate($user);
     $this->task->save();
     $this->assertEquals('simo', $this->task->assignee->name);
     $this->assertEquals(2, $this->task->activity->count());
     $this->assertEquals('user_id', $this->task->activity->get(1)->type);
 }
开发者ID:absolux,项目名称:Collabor8-php-api,代码行数:9,代码来源:TaskTest.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(TaskRequest $request)
 {
     $request->merge(['user_id' => Sentinel::getUser()->id]);
     $task = new Task($request->except('_token'));
     $task->save();
     return $task->id;
 }
开发者ID:jeremyreese,项目名称:quotes,代码行数:12,代码来源:TaskController.php

示例3: store

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

示例4: createTask

 public function createTask(Request $request)
 {
     $task = new Task();
     $task->task_name = $request->get('task_name');
     $task->save();
     return redirect()->back();
 }
开发者ID:ahmedash95,项目名称:todos,代码行数:7,代码来源:TasksController.php

示例5: addTask

 /**
  * 添加任务,返回id
  * @param $name
  */
 public static function addTask($name)
 {
     $model = new Task();
     $model->name = $name;
     $model->save();
     return $model->id;
 }
开发者ID:diandianxiyu,项目名称:LaravelApi,代码行数:11,代码来源:Task.php

示例6: createTask

 public function createTask(Request $request)
 {
     $user_roll = $request->input('user_roll');
     $task_name = $request->input('task_name');
     $team_id = $request->input('team_id');
     if (!CheckLevel::check(2, NULL, $user_roll)) {
         return JSONResponse::response(401);
     }
     //get user id
     $user_id = User::where('user_roll', '=', $user_roll)->pluck('user_id');
     $user = User::where('user_roll', '=', $user_roll)->first();
     if ($user->user_type != 1 && $user->user_type != 0) {
         $team_member = TeamMember::where('user_id', '=', $user_id)->where('team_id', '=', $team_id)->first();
         if ($team_member == NULL) {
             return JSONResponse::response(401);
         }
     }
     $task = new Task();
     $task->task_name = $task_name;
     $task->task_completed = 0;
     $task->team_id = $team_id;
     $success = $task->save();
     if (!$success) {
         return JSONResponse::response(200, false);
     }
     return JSONResponse::response(200, $task);
 }
开发者ID:GokulSrinivas,项目名称:pragyan-oc-app,代码行数:27,代码来源:TaskController.php

示例7: create

 function create(Request $request)
 {
     $task = new Task();
     $task->name = $request->name;
     $task->save();
     return redirect('/');
 }
开发者ID:lopesdalmo,项目名称:Study,代码行数:7,代码来源:TasksController.php

示例8: add

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

示例9: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $task = new Task();
     $task->title = self::capitalize(Input::get('title'));
     $task->created_by = Auth::id();
     if (Input::has('project_id')) {
         $task->project_id = Input::get('project_id');
         Session::set('project_id', $task->project_id);
     }
     $task->hours = Input::has('hours') ? Input::get('hours') : 0;
     $task->closed_at = Input::has('closed_at') ? Input::get('closed_at') : null;
     $task->urgent = Input::has('urgent') ? 1 : 0;
     if (Input::has('closed_at')) {
         $task->urgent = 0;
     }
     // closed tasks are not urgent
     if (Input::has('fixed')) {
         $task->fixed = 1;
         $task->amount = Input::has('amount') ? $task->amount : 0;
     } else {
         $task->fixed = 0;
         $task->amount = $task->hours * ($task->project->rate ?: 0);
     }
     $task->save();
     ProjectController::updateTotals($task->project_id);
     return redirect(Input::get('return_to'));
 }
开发者ID:Rhenan,项目名称:tasks,代码行数:32,代码来源:TaskController.php

示例10: addTask

 public function addTask()
 {
     $task = new Task();
     $task->name = Input::get('name');
     $task->save();
     return redirect('sezgicraft/admin-panel');
 }
开发者ID:mathewsandi,项目名称:Sezgi,代码行数:7,代码来源:TaskController.php

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

示例12: addTask

 public function addTask(Request $req)
 {
     $task = new Task();
     $task->task_content = $req->get('task_content');
     $task->save();
     return redirect()->route('tasks');
 }
开发者ID:leejunkit,项目名称:vashti,代码行数:7,代码来源:HomeController.php

示例13: create

 /**
  * Show the form for creating a new resource.
  * GET /tasks/create
  *
  * @return Response
  */
 public function create()
 {
     // Rules
     $rules = array('weight' => 'integer|between:1,5', 'name' => 'required');
     // Custom messages
     $messages = array('between' => 'The :attribute must be between :min - :max.', 'integer' => ':attribute must be a number');
     // Create validation
     $validator = Validator::make(Input::all(), $rules, $messages);
     // Check validation
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     // Insert the task to database
     $task = new Task();
     $task->project_id = Input::get('projectId');
     $task->user_id = Auth::id();
     $task->name = Input::get('name');
     $task->weight = Input::get('weight');
     if (!Input::get('weight')) {
         $task->weight = 1;
     }
     $task->state = "incomplete";
     $task->save();
     // Increase the users overall task count
     $user = User::find(Auth::id());
     $user->tasks_created = $user->tasks_created + 1;
     $user->save();
     return Redirect::back()->with('success', Input::get('name') . " has been created.");
 }
开发者ID:siparker,项目名称:ribbbon,代码行数:35,代码来源:TasksController.php

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

示例15: store

 public function store()
 {
     $rules = ['name' => 'required', 'description' => 'required', 'estimateTime' => 'required', 'sequence' => 'required'];
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     } else {
         if (Input::has('task_id')) {
             $id = Input::get('task_id');
             $tasks = TaskModel::find($id);
             $alert['msg'] = 'Task has been updated successfully';
         } else {
             $tasks = new TaskModel();
             $tasks->project_id = Input::get('projectId');
             $alert['msg'] = 'Task has been created successfully';
         }
         $tasks->name = Input::get('name');
         $tasks->description = Input::get('description');
         $tasks->estimateTime = Input::get('estimateTime');
         $tasks->sequence = Input::get('sequence');
         $tasks->save();
         $alert['type'] = 'success';
         return Redirect::route('project.view', $tasks->project_id)->with('alert', $alert);
     }
 }
开发者ID:michaelotto126,项目名称:shokes,代码行数:25,代码来源:TaskController.php


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