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


PHP Item::create方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @param ProductRequest $request
  * @return \Illuminate\Http\Response
  */
 public function store(ProductRequest $request)
 {
     $input = $request->all();
     $input['type'] = 'Product';
     Item::create($input);
     return redirect()->route('product.index')->withMessage('Product Added')->withStatus('success');
 }
开发者ID:suchayj,项目名称:easymanage,代码行数:13,代码来源:ProductController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CreateTaskRequest $request)
 {
     //
     $item = \App\Models\Item::create($request->all());
     $item->save();
     return redirect('toDo');
 }
开发者ID:leanne-abarro,项目名称:toDo,代码行数:13,代码来源:ItemsController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @param ServiceRequest $request
  * @return \Illuminate\Http\Response
  */
 public function store(ServiceRequest $request)
 {
     $input = $request->all();
     $input['type'] = 'Service';
     Item::create($input);
     return redirect()->back()->withMessage('Service Added')->withStatus('success');
 }
开发者ID:suchayj,项目名称:easymanage,代码行数:13,代码来源:ServiceController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validation_rules($request);
     $item = $request->input();
     Item::create($item);
     Session::flash('flash_message', 'Data item layanan berhasil ditambahkan!');
     return redirect('admin/item');
 }
开发者ID:thesaputra,项目名称:xyz-prx,代码行数:14,代码来源:ItemController.php

示例5: handle

 /**
  * Handle the command.
  *
  * @param  CreateItemCommand  $command
  * @return boolean
  */
 public function handle(CreateItemCommand $command)
 {
     $item = Item::create(['category_id' => $command->category_id, 'title' => $command->title, 'description' => $command->description, 'extra_description' => $command->extra_description, 'amount' => $command->amount, 'switch' => (int) $command->switch]);
     if (!empty($item)) {
         return $item;
     }
     return false;
 }
开发者ID:nq2916,项目名称:savings,代码行数:14,代码来源:CreateItemCommandHandler.php

示例6: run

 public function run()
 {
     $i = 0;
     do {
         Item::create(['name' => $i . '-item', 'completed' => false]);
         $i++;
     } while ($i <= 10);
 }
开发者ID:emsdog,项目名称:lumen-todo,代码行数:8,代码来源:ItemTableSeeder.php

示例7: store

 public function store(Request $request, $banqueId)
 {
     // verify request inputs
     if (!$request->has(['label', 'valeur', 'id_Competence', 'id_TitreGItem']) || is_null($banqueId)) {
         return response()->json(['error' => 'Bad request'], HttpResponse::HTTP_BAD_REQUEST);
     } else {
         $item = Item::create(['label' => $request->input('label'), 'valeur' => $request->input('valeur'), 'id_Competence' => $request->input('id_Competence'), 'id_TitreGItem' => $request->input('id_TitreGItem'), 'id_Banque' => $banqueId]);
         return is_null($item) ? response()->json(['error' => 'Bad request'], HttpResponse::HTTP_BAD_REQUEST) : $item;
     }
 }
开发者ID:S4M37,项目名称:Project_GangOfThree,代码行数:10,代码来源:ItemController.php

示例8: store

 public function store(Request $request)
 {
     Log::info($request);
     // verify request inputs
     if (!$request->has(['label', 'situation_Clinique', 'instruction_Etudiant', 'instruction_MedObservateur', 'scenarios_Patient', 'id_Domaine', 'id_Critere', 'id_Systeme', 'id_Contexte', 'id_Plainte', 'diagnostic'])) {
         return response()->json(['error' => 'Bad request'], HttpResponse::HTTP_BAD_REQUEST);
     } else {
         $mBanque = json_decode($request->getContent(), true);
         $banque = Banque::create(['label' => $mBanque['label'], 'situation_Clinique' => $mBanque['situation_Clinique'], 'instruction_Etudiant' => $mBanque['instruction_Etudiant'], 'instruction_MedObservateur' => $mBanque['instruction_MedObservateur'], 'scenarios_Patient' => $mBanque['scenarios_Patient'], 'id_Domaine' => $mBanque['id_Domaine'], 'id_Critere' => $mBanque['id_Critere'], 'id_Systeme' => $mBanque['id_Systeme'], 'id_Contexte' => $mBanque['id_Contexte'], 'id_Plainte' => $mBanque['id_Plainte'], 'diagnostic' => $mBanque['diagnostic']]);
         foreach ($mBanque['titres'] as $mTitre) {
             $titre = TitreGItem::create(['nom' => $mTitre['nom'], 'ponderation' => $mTitre['ponderation']]);
             foreach ($mTitre['items'] as $mItem) {
                 $item = Item::create(['label' => $mItem['label'], 'valeur' => $mItem['valeur'], 'id_Competence' => $mItem['id_Competence'], 'id_TitreGItem' => $titre->id_TitreGItem, 'id_Banque' => $banque->id_Banque]);
             }
         }
         foreach ($mBanque['auteurs'] as $auteur) {
             Banque_Enseignant::create(['id_Enseignant' => $auteur, 'id_Banque' => $banque->id_Banque]);
         }
         return is_null($banque) ? response()->json(['error' => 'Bad request'], HttpResponse::HTTP_BAD_REQUEST) : $banque;
     }
 }
开发者ID:S4M37,项目名称:Project_GangOfThree,代码行数:21,代码来源:BanqueController.php

示例9: saveItem

 /**
  * Save item details
  *
  * @param array $data
  * @return int
  */
 public function saveItem($data)
 {
     unset($data['item_id']);
     $item = Item::create($data);
     return $item->id;
 }
开发者ID:sabihk,项目名称:soft,代码行数:12,代码来源:Item.php


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