public function index() { $title = 'Thinner | Colder'; $featuredProducts = Products::where('featured', true)->get(); $featuredDesigns = Designs::where('featured', true)->get(); for ($index = 0; $index < $featuredProducts->count(); $index++) { //$prices = Pricing::where('product_id', $featuredProducts[$index]->id)->get(); //$ordered = $prices->sortBy('pricing'); //$lowest = $ordered->first(); $id = $featuredProducts[$index]->id; $featuredProducts[$index]->lowestPrice = Pricing::LowestPrice($id); } return view('frontend.home', compact('title', 'featuredDesigns', 'featuredProducts')); }
/** * Deletes a pricing * * @param Pricing $pricing * @return array * @throws \Exception */ public function deletePricing(Pricing $pricing) { return $pricing->delete() ? ["status" => "success", "message" => "删除成功"] : ["status" => "error", "message" => "删除失败"]; }