예제 #1
0
 /**
  * Boot the application events.
  * 
  * @return void
  */
 public function boot()
 {
     $this->registerConfig();
     $this->registerTranslations();
     $this->registerViews();
     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());
     }
     view()->share('assets', Module::asset('Admin:webroot'));
 }
예제 #2
0
 public function updateStatus($status, $id)
 {
     try {
         $dado = Categoria::findOrFail($id);
         $dado->status = $status;
         $dado->save();
         session()->flash('flash_message', 'Status alterado com sucesso!');
     } catch (\Exception $e) {
         LogR::exception($dado, $e);
         session()->flash('flash_message', 'Ops!! Ocorreu algum problema!. ' . $e->getMessage());
     }
     return Redirect::back();
 }
예제 #3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     try {
         $dados['put'] = true;
         $dados['dados'] = Subcategoria::findOrFail($id);
         $dados['route'] = 'admin/subcategorias/update';
         $dados['categorias'] = Categoria::all();
         return view('admin::subcategorias/dados', $dados);
     } catch (\Exception $e) {
         LogR::exception('edit subcategorias', $e);
         session()->flash('flash_message', 'Ops!! Ocorreu algum problema!. ' . $e->getMessage());
         return Redirect::back();
     }
 }