Exemplo n.º 1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $show = PhoneShow::find($id);
     if ($show) {
         $product = Input::get('product', 0);
         $level = Input::get('level', 0);
         $details = Input::get('details', null);
         $image = Input::get('image', null);
         $detailsClass = Input::get('tabColor', 0);
         if ($product and $level) {
             $isShow = PhoneShow::whereRaw("level = ? and id <> ?", [$level, $show->id])->first();
             if (!$isShow) {
                 $show->product_id = $product;
                 $show->details = $details;
                 $show->details_class = $detailsClass;
                 // if ($details and $detailsClass) {
                 //     $show->details = $details;
                 //     $show->details_class = $detailsClass;
                 // }
                 $show->level = $level;
                 $show->image = $image;
                 if ($show->save()) {
                     return redirect('admin/show/show');
                 }
             }
         }
     }
     return redirect()->back();
 }