Beispiel #1
0
 public static function getSpecFabric($id)
 {
     return Spec::where("fabric_id", "=", $id)->where("sort", "!=", 0)->orderBy("sort")->get();
 }
Beispiel #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if (Auth::check() && User::isAdmin(Auth::user())) {
         try {
             $spec = Spec::find($id);
             $spec->delete();
             return ["result" => true, "msg" => "Spec deleted succesfully", "id" => $id];
         } catch (QueryException $ex) {
             return ["result" => false, "msg" => "Cannot delete spec, already has an order"];
         }
     } else {
         return ["result" => false, "msg" => "Session not found or not enought permissions"];
     }
 }
Beispiel #3
0
 public function getAjaxFabric($id)
 {
     if ($id == "any") {
         $fabric = Fabric::first();
         $specs = Spec::getSpecFabric($fabric->id);
         $imgs = Image::getImageFabric($fabric->id);
         return ["result" => true, "msg" => "Fabric found", "fabric" => $fabric, "specs" => $specs, "images" => $imgs];
     } else {
         $fabric = Fabric::find($id);
         $specs = Spec::getSpecFabric($fabric->id);
         $imgs = Image::getImageFabric($id);
         return ["result" => true, "msg" => "Fabric found", "fabric" => $fabric, "specs" => $specs, "images" => $imgs];
     }
 }