Пример #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(ProductTypeUpdateRequest $request, $id)
 {
     $productType = new ProductType($request->all());
     ProductType::where('id', $id)->update($productType->getAttributes());
     flash()->success(trans('product_type.label.name'), trans('product_type.message_alert.update_success'));
     return redirect('/product-types');
 }
Пример #2
0
 public function getType($slug)
 {
     $type = ProductType::where(['slug' => $slug])->first();
     $gallery = array();
     foreach ($type->products as $p) {
         $gallery[] = $p->gallery;
     }
     return view('product/type', ['page_title' => $type->name, 'productType' => $type, 'GalleryMatrix' => $gallery]);
 }
Пример #3
0
 /**
  * Queries the product types.
  *
  * @param string $q
  * @return Collection
  */
 public function query($q = null)
 {
     return ProductType::where(function ($query) use($q) {
         $query->where('description', 'like', "%{$q}%");
     })->orderBy('description')->get();
 }