app/Http/Controllers/DistrictController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, $id)
    {
        $district = District::find($id);
        if(!empty($district)) {
            $this->validate($request,  [
                'name' => 'required|max:200',
                'code' => 'alpha_num',
                'province_id' => 'required|numeric',
                'country_id' => 'required|numeric'
            ]);
            $district  = District::setData($district, $request);
            $district->save();
            return redirect()->route('district.index','province='.$request->province_id);
        }
        return redirect()->route('404');
    }
public function update ( Request $ request , $ id ) { $ district = District :: find ( $ id ) ; if ( ! empty ( $ district ) ) { $ this -> validate ( $ request , [ 'name' => 'required|max:200' , 'code' => 'alpha_num' , 'province_id' => 'required|numeric' , 'country_id' => 'required|numeric' ] ) ; $ district = District :: setData ( $ district , $ request ) ; $ district -> save ( ) ; return redirect ( ) -> route ( 'district.index' , 'province=' . $ request -> province_id ) ; } return redirect ( ) -> route ( '404' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .