public function putUpdate(Request $request) { if (!ACL::hasPermission('regulation', 'edit')) { return redirect(route('regulation'))->withErrors(['Você não tem permissão para editar o regulamento.']); } $this->validate($request, ['text' => 'required'], ['text.required' => 'Informe o regulamento']); $regulation = Regulation::find($this->regulationId); $regulation->text = $request->text; $regulation->save(); $success = "Regulamento editado com sucesso!"; return redirect(route('regulation'))->with(compact('success')); }
public function index() { $page = 'regulamento'; $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json"); $pages = Pages::where('slug', '=', $page)->first(); $advertising = Advertising::orderByRaw("RAND()")->get(); foreach ($advertising as $ad) { array_add($ad, "image", Advertising::imageVideo($ad->url)); array_set($ad, "url", Advertising::embedVideo($ad->url, 1)); } $calls = Calls::orderByRaw("RAND()")->limit(2)->get(); $regulation = Regulation::find(1); return view('website.regulation')->with(compact('page', 'websiteSettings', 'pages', 'advertising', 'calls', 'regulation')); }