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 edit($id) { $timer = Timer::findOrFail($id); if (Request::isMethod('get')) { return view('admin.timer_edit', ['timer' => $timer]); } $validator = Validator::make(Request::all(), $this->rules); if ($validator->fails()) { return redirect()->route('timer_edit', [$id])->withInput()->withErrors($validator); } $timer->ends = Request::input('ends'); $timer->enabled = Request::has('enabled'); $timer->save(); return redirect()->route('timer_edit', [$id])->with('msg', 'Изменения сохранены'); }
/** * Delete a timer * @param Request $request * @param $id * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response */ public function destroy(Request $request, $id) { $timer = Timer::findOrFail($id); $timer->delete(); return $this->responseNoContent(); }