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


PHP Item::save方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $item = new Item();
     $item->title = $request->title;
     $item->save();
     return response()->json(['id' => $item->id]);
 }
开发者ID:avlima,项目名称:laravel-event-broadcasting,代码行数:12,代码来源:ItemController.php

示例2: create

 public function create(Requests\ItemRequest $request)
 {
     $name = $request->name;
     $shortdesc = $request->shortdesc;
     $desc = $request->desc;
     $price = $request->price;
     $id = $request->id;
     $characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
     $string = '';
     $random_string_length = 12;
     for ($i = 0; $i < $random_string_length; $i++) {
         $string .= $characters[rand(0, strlen($characters) - 1)];
     }
     $imageName = $name . '_' . $string . '.' . $request->file($id . 'image')->getClientOriginalExtension();
     $item = new Item();
     $item->name = $name;
     $item->shortdesc = $shortdesc;
     $item->desc = $desc;
     $item->image = $imageName;
     $item->group_id = $id;
     $item->price = $price;
     $item->save();
     $request->file($id . 'image')->move(base_path() . '/public/upload/itemimages/', $imageName);
     return redirect('admin/catalogue');
 }
开发者ID:silent-sea,项目名称:silent-sea,代码行数:25,代码来源:ItemsController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(ItemFormRequest $request)
 {
     $item = new Item(['name' => $request->get('name'), 'description' => $request->get('description')]);
     $item->save();
     $item->categories()->attach($request->input('categories'));
     return redirect()->route('items.create')->with('status', 'Your item has been created!');
 }
开发者ID:alidaniel,项目名称:items,代码行数:12,代码来源:ItemsController.php

示例4: store

 public function store(Requests\CreateItemRequest $request)
 {
     $product = new Item();
     $product->item_name = $request->get('item_name');
     $product->category = $request->get('category');
     $product->expiry_date = $request->get('expiry_date');
     $product->search_key = $request->get('search_key');
     $product->quantity = $request->get('quantity');
     $product->unit_price = $request->get('unit_price');
     $product->shops_shop_id = $request->shop_id;
     $product->unit = $request->unit;
     // $product->picture = $request::get('picture');
     if ($request->hasFile('profilePicFile')) {
         $file = Input::file('profilePicFile');
         $name = $request->shop_id . '-' . $product->item_name . $file->getClientOriginalName();
         $product->picture = $name;
         $file->move(public_path() . '/images/' . $product->category . '/', $name);
     }
     $product->discount = $request->get('discount');
     $product->product_code = $request->get('product_code');
     $product->state = $request->get('state');
     $product->description = $request->get('description');
     // $data['country'] = Product::getCountryOptions();
     //Auth::user()->Items()->save($product);
     \Session::flash('success', 'Product successfully added!');
     $product->save();
     return \Redirect::back();
     //->with($data);
 }
开发者ID:pius-ng3a,项目名称:go_orderdeliver,代码行数:29,代码来源:ProductController.php

示例5: postAddItemStepTwo

 private function postAddItemStepTwo(ItemRequest $request)
 {
     //Create new item
     $item = new Item();
     $item->name = $request->name;
     $item->description = $request->description;
     $item->price = $request->price;
     $item->by_mail = $request->by_mail ? 1 : 0;
     $item->user()->associate(Auth::user());
     $item->save();
     //Create new itemAttributes based on the defaultAttributes of the market
     foreach ($request->itemAttributes as $name => $value) {
         $itemAttribute = new ItemAttribute();
         $itemAttribute->name = $name;
         $itemAttribute->value = $value;
         $itemAttribute->item()->associate($item);
         $itemAttribute->save();
     }
     //Create new itemPhotos
     /*if (!empty($request->itemPhotos))
       {
           foreach ($request->get('itemPhotos') as $itemPhoto)
           {
               var_dump($itemPhoto);exit;
           }
       }*/
 }
开发者ID:udoblunt,项目名称:marketplaces,代码行数:27,代码来源:ItemController.php

示例6: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $item = new Item();
     $item->item_name = trim($request->get('item_name'));
     $item->item_id = (int) $request->get('item_id');
     $item->save();
     return redirect('/item')->withSuccess("Item {$item->item_name} was created");
 }
开发者ID:HostOnNet,项目名称:merch.runerank.com,代码行数:14,代码来源:ItemController.php

示例7: postItemCreate

 public function postItemCreate(ItemsPostRequest $request)
 {
     if ($request->name) {
         $item = new Item();
         $item->name = $request->name;
         $item->save();
     }
     return redirect()->back();
 }
开发者ID:haruya,项目名称:collections,代码行数:9,代码来源:GathersController.php

示例8: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $this->validate($request, ['schedule' => 'required', 'category' => 'required', 'type' => 'required']);
     $data = new Item();
     $data->auction_schedule_id = $request->schedule;
     $data->users_id = Auth::user()->id;
     $data->ticket_no = $request->ticket_no;
     $data->category_id = $request->category;
     $data->type_id = $request->type;
     $data->price = $request->price;
     $data->description = $request->description;
     $data->save();
     $item_id = $data->id;
     $destinationPath = 'images/' . Auth::user()->id . '/' . $request->ticket_no;
     File::makeDirectory($destinationPath, 0777, TRUE, TRUE);
     foreach ($request->file('image') as $key => $photo) {
         if ($photo) {
             if ($photo->isValid()) {
                 // original
                 $filename_original = 'image_' . $key . '_original.jpg';
                 Image_::make($photo->getRealPath())->save($destinationPath . '/' . $filename_original);
                 $data = new Image();
                 $data->items_id = $item_id;
                 $data->url = $destinationPath . '/' . $filename_original;
                 $data->save();
                 // for grid view
                 $filename = $destinationPath . '/' . 'image_' . $key . '_349x200.jpg';
                 ph::resize_image($destinationPath . '/' . $filename_original, 349, 200, $filename);
                 $data = new Image();
                 $data->items_id = $item_id;
                 $data->url = $filename;
                 $data->save();
                 // for view page (big)
                 $filename = $destinationPath . '/' . 'image_' . $key . '_725x483.jpg';
                 ph::resize_image($destinationPath . '/' . $filename_original, 725, 483, $filename);
                 $data = new Image();
                 $data->items_id = $item_id;
                 $data->url = $filename;
                 $data->save();
                 // for view page (thumbnail)
                 $filename = $destinationPath . '/' . 'image_' . $key . '_173x126.jpg';
                 ph::resize_image($destinationPath . '/' . $filename_original, 173, 126, $filename);
                 $data = new Image();
                 $data->items_id = $item_id;
                 $data->url = $filename;
                 $data->save();
             } else {
                 Session::flash('message', 'uploaded file is not valid');
                 return redirect('/item');
             }
         }
     }
     Session::flash('message', 'Item with ticket #' . $request->ticket_no . ' was successfully created');
     return redirect('/item');
 }
开发者ID:NavarezCorp,项目名称:prenda,代码行数:62,代码来源:ItemController.php

示例9: save

 public function save(Request $request, Response $response, array $args)
 {
     $_POST = array_filter($_POST, 'trim');
     $metadata = array('id' => filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT), 'title' => filter_input(INPUT_POST, 'title'), 'description' => filter_input(INPUT_POST, 'description'), 'date' => filter_input(INPUT_POST, 'date'), 'date_granularity' => filter_input(INPUT_POST, 'date_granularity', FILTER_SANITIZE_NUMBER_INT), 'edit_group' => filter_input(INPUT_POST, 'edit_group', FILTER_SANITIZE_NUMBER_INT), 'read_group' => filter_input(INPUT_POST, 'read_group', FILTER_SANITIZE_NUMBER_INT));
     $tags = filter_input(INPUT_POST, 'tags');
     $item = new Item(null, $this->user);
     $item->save($metadata, $tags, $_FILES['file']['tmp_name'], filter_input(INPUT_POST, 'file_contents'));
     $config = new Config();
     return new RedirectResponse($config->baseUrl() . '/' . $item->getId());
 }
开发者ID:samwilson,项目名称:swidau,代码行数:10,代码来源:ItemController.php

示例10: store

 public function store(Request $request)
 {
     $item = new Item();
     $item->setSymPass($request->session()->get('sym_pass'));
     $item->key = $request->key;
     $item->val = $request->val;
     $item->resource_id = $request->resource_id;
     $item->save();
     return redirect()->route('resource.show', ['id' => $request->resource_id]);
 }
开发者ID:ruslan2k,项目名称:web-password,代码行数:10,代码来源:ItemController.php

示例11: createItem

 public function createItem()
 {
     $sname = Input::get('subcategory_id');
     $subname = ItemSubcategory::where('name', $sname)->first();
     $item = new Item();
     $item_params = array_merge(Input::only(['code', 'sku', 'generic', 'brand', 'make', 'model', 'color', 'description', 'category_id', 'uom_id', 'inventory_types_id']), ['size_dim' => Input::get('size_dimension'), 'gauge_thick' => Input::get('gauge_thickness'), 'reorder_lvl' => Input::get('reoderlevel'), 'subcategory_id' => $subname->id, 'inventory_types_id' => Input::get('inventory_types')]);
     $item->fill($item_params);
     $item->save();
     return redirect()->action('Operations\\ItemController@displayItems')->with('message', 'Item Successfully Added.');
 }
开发者ID:esmeromichael,项目名称:grading,代码行数:10,代码来源:ItemController.php

示例12: addItem

 static function addItem($request)
 {
     $item = new Item();
     $item->user_id = $request->input('user_id');
     $item->name = $request->input('name');
     $item->specifications = $request->input('specifications');
     $item->link = $request->input('link');
     $item->rank = $request->input('rank');
     $item->save();
 }
开发者ID:michael-dean-haynie,项目名称:my-secret-santa,代码行数:10,代码来源:Item.php

示例13: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\CreateItemRequest $request)
 {
     $input = Request::all();
     $item = new Item();
     $item->name = $input['name'];
     $item->unit = $input['unit'];
     $item->description = $input['description'];
     $item->save();
     $id = $item->id;
     return redirect()->action('ItemsController@index');
 }
开发者ID:jacqhernandez,项目名称:hsms,代码行数:17,代码来源:ItemsController.php

示例14: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $item = new Item();
     $item->setTable($this->getLoginUsername());
     $item->taskname = $request->taskname;
     $item->description = $request->description;
     $item->deadline = $request->deadline;
     $item->important = $request->has('important') ? 1 : 0;
     $item->save();
     return redirect()->refresh();
 }
开发者ID:kakaacac,项目名称:loudengdeng,代码行数:17,代码来源:ToDoListController.php

示例15: add

 public function add(Request $request)
 {
     //Get max item order id and add 1
     $order = Item::orderBy('item_order', 'desc')->pluck('item_order');
     $order++;
     $item = new Item();
     $item->title = $request->input('entry');
     $item->item_order = $order;
     $item->save();
     $returnId = $item->id;
     return array("id" => $returnId);
 }
开发者ID:jurewerk,项目名称:draggproject,代码行数:12,代码来源:ItemController.php


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