public static function unit_list() { $types = Sell_Units::all(); foreach ($types as $key => $value) { $list = DB::table("sell_units")->where("unit_type_id", $value->id)->get(); $types[$key]->list = $list; } return $types; }
public function showSellUnits() { //$types = DB::table("sell_units_type")->get(); $types = Sell_Units::unit_list(); return view('/dashboard/orders/units', ["title" => "銷售單位管理", "types" => $types]); }