/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $regions = Region::all(); $countries = Country::orderBy('name', 'asc')->get(); $offers_air = Offer_air::orderBy('offerId', 'asc')->get(); return view('cms/tags/create')->with('regions', $regions)->with('countries', $countries)->with('offers_air', $offers_air); }
/** * Remove the specified resource from storage. * * @param int $id_region * @return \Illuminate\Http\Response */ public function destroy($id_region) { $region = Region::findOrFail($id_region); $region_name = $region->name; $region->delete(); $region_countries = Country::where('id_region', $id_region)->get(); foreach ($region_countries as $country) { $country->id_region = null; $country->save(); } return redirect()->route('regions.index')->with('message_delete', 'Region ' . $region_name . ' has been successfully deleted'); }