Exemplo n.º 1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $validacao = Validator::make($request->all(), ['codigo' => 'required|string']);
     if ($validacao->fails()) {
         return redirect('admin/configuracoes/analytics')->withErrors($validacao)->withInput();
     } else {
         try {
             $analytic = Analytics::find($id);
             $analytic->codigo = $request->codigo;
             $analytic->save();
             session()->flash('flash_message', 'Registro atualizado com sucesso!');
             return redirect('admin/configuracoes/analytics');
         } catch (\Exception $e) {
             LogR::exception($analytic, $e);
             session()->flash('flash_message', 'Ops!! Ocorreu algum problema!. ' . $e->getMessage());
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     if (collect(Analytics::find(1))->contains(1)) {
         view()->share('analytics', Analytics::find(1));
     }
     if (collect(Configuracao::find(1))->contains(1)) {
         view()->share('confsite', Configuracao::find(1));
     }
     if (collect(Comentarios::where('id_status_comentario', 1)->get())->count()) {
         view()->share('comments', collect(Comentarios::where('id_status_comentario', 1)->get())->count());
     }
     view()->share('sobre', Sobres::findOrFail(1));
     if (Request::is('blog') or Request::is('blog/*')) {
         view()->share('categorias', Categoria::where('id_tipo_categoria', 3)->get());
         view()->share('ultimas', collect(Noticia::todas())->take(4));
     }
     if (Request::is('admin') or Request::is('admin/*')) {
         view()->share('ajuda', Helps::all());
     }
 }