public function update(LocationUpdateRequest $request, $id)
 {
     $location = new Location($request->all());
     Location::where('id', $id)->update($location->getAttributes());
     flash()->success(trans('location.label.name'), trans('location.message_alert.update_success'));
     return redirect('/locations');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(LocationUpdateRequest $request, $id)
 {
     $state = State::findOrFail($id);
     $state->name = $request->input('state');
     $state->save();
     $lgas = $request->input('lga');
     $real = [];
     $state->lgas()->delete();
     foreach ($lgas as $lga) {
         if ($existingArea = Lga::where('name', $lga)->first()) {
             $real[] = $existingArea;
         } else {
             $newArea = new Lga();
             $newArea->name = $lga;
             $newArea->save();
             $real[] = $newArea;
         }
     }
     $state->lgas()->saveMany($real);
     return redirect("/admin/location/")->withSuccess("Changes saved.");
 }