當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Task::create方法代碼示例

本文整理匯總了PHP中app\models\Task::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP Task::create方法的具體用法?PHP Task::create怎麽用?PHP Task::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\models\Task的用法示例。


在下文中一共展示了Task::create方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: store

 /**
  * Store a newly created resource in storage via ajax.
  */
 public function store(TaskRequest $request)
 {
     if ($request->ajax()) {
         return Task::create($request->all());
     }
     return view('errors.404');
 }
開發者ID:unclefudge,項目名稱:whs,代碼行數:10,代碼來源:TaskController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     //接受任務創建表單的數據
     //$date = $request->all();
     //dd($date);//測試數據正確性
     Task::create($request->all());
     return redirect('/feature/project/' . $request->input('project_id') . '/task');
 }
開發者ID:saviorZSC,項目名稱:zsc_laravel,代碼行數:13,代碼來源:TaskController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Project $project
  * @param  \Illuminate\Http\Request  $request
  * @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', 'Nova tarefa criada.');
 }
開發者ID:novaskideveloper,項目名稱:PeaceLabs,代碼行數:15,代碼來源:TasksController.php

示例4: postCreate

 public function postCreate(Request $request)
 {
     $input = $request->only(['name']);
     $input['user_id'] = Auth::id();
     $input['course_id'] = Auth::user()->course_id;
     Task::create($input);
     flash()->message('Zadanie bolo vytvorené');
     return redirect()->back();
 }
開發者ID:psiskova,項目名稱:blog-academy,代碼行數:9,代碼來源:TaskController.php

示例5: store

 public function store()
 {
     $data = Input::all();
     if (is_array($data) && !empty($data)) {
         unset($data['_token']);
         $task = Task::create(array("title" => $data['title'], "description" => $data['description'], "due_date" => date("Y-m-d h:i:s", strtotime($data['due_date'])), "status" => $data['status']));
         return response()->json(['status' => 'success', 'data' => $task]);
     } else {
         return response()->json(['status' => 'error', 'msg' => "Invalid data!"]);
     }
 }
開發者ID:devchd,項目名稱:todo,代碼行數:11,代碼來源:TasksController.php

示例6: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Project $project
  * @param  \Illuminate\Http\Request  $request
  * @return Response
  */
 public function store(Project $project, Request $request)
 {
     $this->middleware('auth');
     if ($project->ismember(auth()->user()) || access()->hasRole('Administrator')) {
         $this->validate($request, $this->rules);
         $input = $this->filter_task_input();
         $input['slug'] = $this->makeSlugFromTitle($input['name']);
         $input['project_id'] = $project->id;
         Task::create($input);
         return Redirect::route('projects.show', $project->slug)->with('message', 'Nova tarefa criada.');
     } else {
         return Redirect::route('home')->with('flash_danger', 'Operação não permitida.');
     }
 }
開發者ID:CodeForBrazil,項目名稱:PeaceLabs,代碼行數:21,代碼來源:TasksController.php

示例7: store

 /**
  * Store a newly created resource in storage.
  * POST /tasks
  *
  * @return Response
  */
 public function store($project, TasksRequest $request)
 {
     $task = Task::create($request->all());
     return Redirect::back()->with('okmessage', 'New task has been added');
 }
開發者ID:bishopm,項目名稱:circuit,代碼行數:11,代碼來源:TasksController.php

示例8: run

 public function run()
 {
     Task::create(['name' => 'Task example', 'deadline' => date("H:i:s"), 'progress' => false]);
 }
開發者ID:Retsediv,項目名稱:edu,代碼行數:4,代碼來源:TaskTableSeeder.php

示例9: import_xls

 /**
  * static function to read the xls and store
  *
  * @param  int  $id
  * @return Response*/
 public static function import_xls($pathname, $card_id = false, $camp_id = false)
 {
     Excel::load($pathname, function ($reader) use($card_id, $camp_id) {
         // Getting all results
         $results = $reader->get();
         $cnt = 1;
         foreach ($results as $result) {
             //checking existing Ditrict in db
             if ($cnt < 6) {
                 if ($card_id) {
                     $exitdist = Card::where('id', $card_id)->first();
                 } else {
                     $exitdist = Card::where('name', $result->card)->first();
                 }
                 if ($camp_id) {
                     $camp = Camp::where('id', $camp_id)->first();
                 } else {
                     $camp = Camp::where('name', $result->camp)->first();
                 }
                 $save['card_id'] = @$exitdist->id;
                 $save['camp_id'] = @$camp->id;
                 $save['title'] = $result->title;
                 $save['description'] = ' Order Id :' . $result->order_id . ', Ship date:' . $result->ship_date;
                 $save['added_by'] = Auth::user()->id;
                 $save['status'] = $result->status;
                 $save['order_amount'] = $result->order_amount;
                 $save['actual_time_to_deliver'] = $result->actual_time_to_deliver;
                 $save['payment_method'] = $result->payment_method;
                 $save['address_type'] = $result->address_type;
                 $save['address'] = ' Customer_name:' . $result->customer_name . ', Status:' . $result->status . ', City:' . $result->city . ', District' . $result->district . ', Province' . $result->province . ', Customer Phone' . $result->customer_phone;
                 Task::create($save);
                 if (@$camp->title) {
                     $timeline['description'] = Auth::user()->first_name . ' ' . Auth::user()->last_name . ' has imported the task for <a href="javascript:;">' . $camp->title . '</a>';
                     $timeline['object_type'] = 6;
                     $timeline['object_id'] = $camp->id;
                     Timeline::create($timeline);
                 }
                 if (@$exitdist->name) {
                     $timeline['description'] = Auth::user()->first_name . ' ' . Auth::user()->last_name . ' has imported the task for <a href="javascript:;">' . @$exitdist->name . '</a>';
                     $timeline['object_type'] = 6;
                     $timeline['object_id'] = $exitdist->id;
                     Timeline::create($timeline);
                 }
                 unset($save);
             }
             $cnt++;
         }
     });
 }
開發者ID:mahitiinfo,項目名稱:rubanbridge,代碼行數:54,代碼來源:TaskController.php

示例10: trades

 /**
  * Migrate Trades
  */
 public function trades()
 {
     echo "<h1>Migrating Trades</h1>";
     DB::table('z_lookup_trades')->truncate();
     DB::table('z_lookup_tasks')->truncate();
     // Create initial records
     $notrade = Trade::create(array('name' => 'No Trade', 'status' => '1', 'company_id' => '1', 'created_by' => '1', 'updated_by' => '1'));
     $trades = zTrade::all();
     $trades->each(function ($trade) {
         $active_trade = '0';
         if ($trade->active == "y") {
             $active_trade = '1';
         }
         $newtrade = Trade::create(array('name' => reformatOldStr($trade->name), 'status' => $active_trade, 'company_id' => '3', 'created_by' => '1', 'updated_by' => '1'));
         zLookupTrade::create(array('old' => $trade->id, 'new' => $newtrade->id));
         echo "<b> {$trade->name}  [{$trade->id}]->[{$newtrade->id}]</b><br>";
         $tasks = zTask::where('trade_id', '=', $trade->id)->get();
         foreach ($tasks as $task) {
             $active_task = '0';
             if ($task->active == "y") {
                 $active_task = '1';
             }
             $upcoming_task = '0';
             if ($task->upcoming == "y") {
                 $upcoming_task = '1';
             }
             $newtask = Task::create(array('name' => reformatOldStr($task->name), 'code' => reformatOldStr($task->code), 'upcoming' => $upcoming_task, 'status' => $active_task, 'trade_id' => $newtrade->id, 'created_by' => '1', 'updated_by' => '1'));
             zLookupTask::create(array('old' => $task->id, 'new' => $newtask->id));
             echo "<b> {$task->name}  [{$task->id}]->[{$newtask->id}]</b><br>";
         }
         echo "<br>";
     });
     echo "<h1>Completed</h1>";
 }
開發者ID:unclefudge,項目名稱:whs,代碼行數:37,代碼來源:MigrationController.php

示例11: create

 public function create(Request $request)
 {
     Task::create(['name' => $request->name, 'deadline' => $request->deadline, 'user_id' => $request->user()->id]);
 }
開發者ID:Retsediv,項目名稱:edu,代碼行數:4,代碼來源:TaskRepository.php


注:本文中的app\models\Task::create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。