public function update(Brand $brand, Request $request)
 {
     $brand->alternate = $request->alternate;
     $brand->visible = $request->visible;
     $brand->save();
     return ['message' => 'Brand update successful !'];
 }
Example #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $brand = new Brand();
     $brand->name = Input::get('name');
     $brand->save();
     return Redirect()->route('brand-list');
 }
Example #3
0
 /**
  *
  */
 public function loadFeed()
 {
     $xml = $this->reader->load($this->feedUrl);
     $content = $xml->getContent();
     $this->content = $xml->getContent();
     foreach ($content as $product) {
         $item = Product::where('externalUrl', '=', $product->productUrl)->first();
         if (!$item) {
             $item = new Product();
         }
         if (strlen($product->brand) > 1) {
             $brand = Brand::where('name', '=', $product->brand)->first();
             if (!$brand) {
                 $brand = new Brand();
                 $brand->name = $product->brand;
                 $brand->save();
             }
             if ($brand->id) {
                 $item->brand = $brand->id;
             }
         }
         $item->name = $product->name;
         $item->description = $product->description;
         $item->price = $product->price;
         $item->regularPrice = $product->regularPrice;
         $item->shippingPrice = $product->shippingPrice;
         $item->externalUrl = $product->productUrl;
         $item->imageUrl = $product->graphicUrl;
         $item->save();
     }
 }
 public function insert_brand(Request $request)
 {
     $brand = new Brand();
     $brand->brand_name = $request->input('bname');
     $brand->manufacturer = $request->input('manu');
     $brand->remarks = $request->input('remarks');
     $brand->save();
 }
Example #5
0
 public function store(Requests\BrandRequest $request)
 {
     $brand = new Brand(['name' => $request->get('name'), 'code' => $request->get('code')]);
     // this automatically applies the user id for
     //the relations ship
     $brand->save();
     flash()->success('Brand has been created.');
     return redirect('/brands/' . $brand->id . '/edit');
 }
Example #6
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(BrandFormRequest $request)
 {
     $brand = new Brand();
     $brand->name = $request->get('name');
     $brand->user_id = $request->user()->id;
     $brand->save();
     $message = "Brand has been successfully added";
     return redirect('/brand/index')->withMessage($message);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['brand_name' => 'required|unique:brand'], ['brand_name.required' => 'Please enter brand name.'], ['brand_name.unique' => 'brand already exists']);
     $brand = new Brand();
     $brand->brand_name = $request->brand_name;
     $brand->slug = $request->slug;
     $brand->save();
     $brand->category()->sync($request->cate);
     return redirect()->route('admin.brand.index')->with('alert-success', 'ADD complete');
 }
Example #8
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     if (\Input::get('id')) {
         $brand = Brand::find(\Input::get('id'));
     } else {
         $brand = new Brand();
     }
     $brand->title = \Input::get('title');
     if ($brand->save()) {
         return $this->index();
     }
 }
Example #9
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Requests\BrandRequest $request)
 {
     $brand = new \App\Brand();
     $brand->city_id = $request->city_id;
     $brand->brand_type_id = $request->brand_type_id;
     $brand->brand_name = $request->brand_name;
     $brand->description = $request->description;
     $brand->logo = $request->logo;
     $brand->video = $request->video;
     $brand->save();
     return redirect('admin/brands');
 }
Example #10
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $validator = Validator::make($request->all(), ['picture' => 'mimes:jpeg,png', 'name' => 'unique:brands,name']);
     if ($validator->fails()) {
         return redirect('brands/create')->withErrors($validator)->withInput();
     }
     $image = Input::file('picture');
     $filename = date('YmdHis') . "-" . $image->getClientOriginalName();
     $brand = new Brand(array('name' => $request->get('name'), 'picture' => $filename, 'description' => $request->get('description')));
     $brand->save();
     $request->file('picture')->move(base_path() . '/public/admin/brandlogo/', $filename);
     return redirect('brands');
 }
Example #11
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $object = new Model();
     $params = $request->only('title', 'text');
     $filter = $object->validator($params);
     if ($filter->fails()) {
         $error = $filter->errors()->toArray();
         return view('admin.brand.create', ['input' => $params, 'error' => $error]);
     }
     $object->fill($params);
     $object->save();
     return redirect('admin/brand/' . $object->id);
 }
 public function brandsave(BrandRequest $request)
 {
     $brand = new Brand(array('name' => $request->get('name')));
     $brand->save();
     Session::flash('flash_message', 'Well done! Nhãn hiệu mới đã được tạo thành công.');
     Session::flash('flash_type', 'alert-success');
     return \Redirect::route('brands');
 }