get(); return view('region.index', compact('regions')); } public function create() { $countries = Country::all(); return view('region.create', compact('countries')); } public function store(Request $request) { $request->validate([ 'country_id' => 'required', ]); Region::create($request->post()); return redirect()->route('regions.index')->with('success','region has been created successfully.'); } public function edit(Region $region) { $countries = Country::all(); return view('region.edit',compact('region', 'countries')); } public function update(Request $request, Region $region) { $request->validate([ 'country_id' => 'required', ]); $region->fill($request->post())->save(); return redirect()->route('regions.index')->with('success','regions Has Been updated successfully'); } public function destroy(Region $region) { $region->delete(); return redirect()->route('regions.index')->with('success','regions has been deleted successfully'); } }