public function __construct() { $this->site_infos = Site_infos::first(); $this->destination = Country::select('id', 'name', 'url')->where('status', 'Active')->get(); $this->menu = Page::where('status', 'Active')->where('parent_id', 0)->where('status', 'Active')->get(); /** * find parent id on the menu and concatenate related sub menu to Array * */ foreach ($this->menu as $key => $m) { $this->menu[$key]->sub_menu = Page::where('parent_id', $m->id)->where('status', 'Active')->get()->toArray(); } /** * find the country related category */ foreach ($this->destination as $key => $d) { $this->destination[$key]->category = category::select('name', 'url')->where('country_id', $d->id)->where('status', 'Active')->get()->toArray(); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function EditAction(Request $request) { $this->site_info = Site_infos::all(); if ($request->isMethod('post')) { $this->site_info[0]->company_name = $request->get('company_name'); $this->site_info[0]->company_address1 = $request->get('company_address1'); $this->site_info[0]->company_address2 = $request->get('company_address2'); $this->site_info[0]->company_primary_phone = $request->get('company_primary_phone'); $this->site_info[0]->company_secondary_phone = $request->get('company_secondary_phone'); $this->site_info[0]->company_sending_email = $request->get('company_sending_email'); $this->site_info[0]->facebook_link = $request->get('facebook_link'); $this->site_info[0]->twitter_link = $request->get('twitter_link'); $this->site_info[0]->google_plus_link = $request->get('google_plus_link'); $this->site_info[0]->save(); return redirect()->route('site_infos')->with('message', Lang::get('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'Your Request is Successful'])); } return view('admin.site_info.site_info_update', ['site_info' => $this->site_info[0]]); }