/** * 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()); } }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { try { Helps::destroy($id); session()->flash('flash_message', 'Registro apagado com sucesso'); } catch (\Exception $e) { LogR::exception('destroy help', $e); session()->flash('flash_message', 'Ops!! Ocorreu algum problema!. ' . $e->getMessage()); } return Redirect::back(); }