diff --git a/app/Http/Controllers/ExercicioController.php b/app/Http/Controllers/ExercicioController.php index 4a06445..57977c7 100644 --- a/app/Http/Controllers/ExercicioController.php +++ b/app/Http/Controllers/ExercicioController.php @@ -27,11 +27,22 @@ class ExercicioController extends Controller /** * Display a listing of the resource. * - * @return \Illuminate\Http\Response */ public function index() { - return redirect()->action([TopicoController::class, 'index']); + $topicos = Topico::orderBy('order'); + $semTopico = Exercicio::whereDoesntHave('topico')->orderBy('name'); + /** @var \App\Models\User */ + $user = Auth::user(); + if (optional($user)->isAdmin()) { + $topicos = $topicos->with('exercicios'); + } else { + $topicos = $topicos->with('exerciciosPublished'); + $semTopico = $semTopico->published(); + } + + return View('exercicio.index')->with('topicos', $topicos->get()) + ->with('semTopico', $semTopico->get()); } /** diff --git a/app/Http/Controllers/TopicoController.php b/app/Http/Controllers/TopicoController.php index 465fba6..929b415 100644 --- a/app/Http/Controllers/TopicoController.php +++ b/app/Http/Controllers/TopicoController.php @@ -15,19 +15,7 @@ class TopicoController extends Controller */ public function index() { - $topicos = Topico::orderBy('order'); - $semTopico = Exercicio::whereDoesntHave('topico')->orderBy('name'); - /** @var \App\Models\User */ - $user = Auth::user(); - if (optional($user)->isAdmin()) { - $topicos = $topicos->with('exercicios'); - } else { - $topicos = $topicos->with('exerciciosPublished'); - $semTopico = $semTopico->published(); - } - - return View('topico.index')->with('topicos', $topicos->get()) - ->with('semTopico', $semTopico->get()); + return redirect()->action([ExercicioController::class, 'index']); } /** diff --git a/resources/views/exercicio/index.blade.php b/resources/views/exercicio/index.blade.php index 035d97f..b1f3323 100644 --- a/resources/views/exercicio/index.blade.php +++ b/resources/views/exercicio/index.blade.php @@ -1,6 +1,5 @@ @extends('layouts.base') @section('content') -