本文整理汇总了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]);
}
示例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');
}
示例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!');
}
示例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);
}
示例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;
}
}*/
}
示例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");
}
示例7: postItemCreate
public function postItemCreate(ItemsPostRequest $request)
{
if ($request->name) {
$item = new Item();
$item->name = $request->name;
$item->save();
}
return redirect()->back();
}
示例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');
}
示例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());
}
示例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]);
}
示例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.');
}
示例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();
}
示例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');
}
示例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();
}
示例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);
}