public function jsonSerialize() { $subdivision = call_user_func('get_object_vars', $this); $subdivision['subdivisionType'] = $this->subdivisionType->jsonSerialize(); $subdivision['country'] = $this->country->jsonSerialize(); return array_except($subdivision, ['__initializer__', '__cloner__', '__isInitialized__']); }
public function jsonSerialize() { $address = $this->getPublicVars(); $address['subdivision'] = !is_null($this->subdivision) ? $this->subdivision->jsonSerialize() : NULL; $address['country'] = !is_null($this->country) ? $this->country->jsonSerialize() : NULL; return array_except($address, ['__initializer__', '__cloner__', '__isInitialized__']); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $country = Country::findOrFail($id); $country->delete(); flash()->success('Страна удалена.'); return redirect()->route('admin.countries.index'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $city = City::findOrFail($id); $countriesList = Country::lists('name', 'id'); return view('admin.cities.edit', compact('city', 'countriesList')); }