app/Http/Controllers/DistrictController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $this->validate($request, [
            'name' => 'required|max:200',
            'code' => 'numeric',
            'province_id' => 'required|numeric',
            'country_id' => 'required|numeric'
        ]);
        $district = new District();
        $district = District::setData($district, $request);
        $district->save();
        return redirect()->route('district.index','province='.$district->province_id);
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , [ 'name' => 'required|max:200' , 'code' => 'numeric' , 'province_id' => 'required|numeric' , 'country_id' => 'required|numeric' ] ) ; $ district = new District ( ) ; $ district = District :: setData ( $ district , $ request ) ; $ district -> save ( ) ; return redirect ( ) -> route ( 'district.index' , 'province=' . $ district -> province_id ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .