public function edit($id) { $t = Title::findOrFail($id); if (Request::isMethod('get')) { return view('admin.title_edit', ['t' => $t]); } $validator = Validator::make(Request::all(), $this->rules); if ($validator->fails()) { return redirect()->route('title_edit', [$id])->withInput()->withErrors($validator); } $t->text = Request::input('text'); $t->eng = Request::input('eng'); $t->first = Request::input('first'); $t->second = Request::input('second'); $t->firstEng = Request::input('firstEng'); $t->secondEng = Request::input('secondEng'); $t->vacancyAnnounce = Request::input('vacancyAnnounce'); $t->vacancyText = Request::input('vacancyText'); $t->enabled = Request::has('enabled'); if ($file = Request::file('photo')) { $t->photo = $this->upload($file, 'photo'); } $t->save(); return redirect()->route('title_edit', [$id])->with('msg', 'Изменения сохранены'); }
public function homepage() { $params = array('logo' => Title::findOrFail(1), 'timer' => Timer::findOrFail(1), 'about' => About::findOrFail(1), 'contacts' => Contact::where('enabled', '=', true)->orderBy('id', 'ASC')->get(), 'grouped' => GroupRepository::grouped(), 'offices' => Office::where('enabled', '=', true)->orderBy('position', 'ASC')->get(), 'title' => 'TWIGA – крупнейшая независимая коммуникационная группа в России и странах СНГ'); /*if (Request::has('r')) { $r = Request::get('r'); Session::set('r', $r); return redirect('/#' . $r); }*/ $view = Agent::isTablet() || Request::has('t') ? 'tablet.homepage' : (Agent::isMobile() || Request::has('m') ? 'mobile.homepage' : 'index.homepage'); return view($view, $params); }
public function vacancy() { $params = array('logo' => Title::findOrFail(1), 'vacancyGroups' => VacancyRepository::grouped(), 'title' => 'Работа и стажировка | TWIGA'); $view = Agent::isTablet() || Request::has('t') ? 'tablet.vacancy' : (Agent::isMobile() || Request::has('m') ? 'mobile.vacancy' : 'index.vacancy'); return view($view, $params); }