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]; } }