Exemplo n.º 1
0
Arquivo: Tema.php Projeto: fluzo/foro
 public function getTema($slug_tema, $foro)
 {
     $id_slug = $this->slug_id($slug_tema);
     // Separamos el id del slug para buscar por el
     // Buscamos por id y slug, pero podria ser solo por id
     return \Fluzo\Foro\Tema::where('id', '=', $id_slug['id'])->where('slug', '=', $id_slug['slug'])->where('foro_id', '=', $foro->id)->where('aprobado', '=', true)->firstOrFail();
 }
Exemplo n.º 2
0
 public function mostrar()
 {
     $temas = Tema::where('aprobado', '=', false)->orderBy('created_at', 'asc')->paginate(1);
     $posts = Post::where('aprobado', '=', false)->orderBy('created_at', 'asc')->paginate(1);
     if (!is_null($posts->first())) {
         return \View::make('foro::pendiente')->with('contenidos', $posts);
     } elseif (!is_null($temas->first())) {
         return \View::make('foro::pendiente')->with('contenidos', $temas);
     }
     return \View::make('foro::pendiente')->with('contenidos', null);
 }