How to return the page in LARAVEL 5.4

Asked

Viewed 953 times

0

I am with a problem, I am with 4 table, Courses, disciplines, teachers and templates, each with a page for themselves, when I change or delete something in disciplines, teachers I return to the courses page, I want to return to the page itself. I’m using the laravel 5.4

 <!-- Cursos -->
            <div id="Cursos" class="tab-info" style="display:block;">
                @if(session('message'))
                    <p class='box-alert-info'>{{ session('message') }}</p>
                @endif
                @if(session('error'))
                    <p class='box-alert-error'>{{ session('error') }}</p>
                @endif
                <p><a href='#' class='modal-btn button special icon fa-plus' name='novoCurso'>Novo curso</a></p>
                <div class="table-wrapper">
                    <table>
                        <thead>
                            <tr>
                                <th>Curso</th>
                                <th>Editar</th>
                                <th>Excluir</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach ($cursos as $curso)
                                <tr>
                                    <td>{{ $curso->nome }}</td>
                                    <td><a href="/administrador/cursos/editar/{{ $curso->id }}">Editar</a></td>
                                    <td><a href="/administrador/cursos/deletar/{{ $curso->id }}">Excluir</a></td>
                                </tr>
                            @endforeach
                        </tbody>
                    </table>
                </div>
            </div>
            <!-- Disciplinas -->
            <div id="Disciplinas" class="tab-info">
                @if(session('message'))
                    <p class='box-alert-info'>{{ session('message') }}</p>
                @endif
                @if(session('error'))
                    <p class='box-alert-error'>{{ session('error') }}</p>
                @endif
                <p><a href='#' class='modal-btn button special icon fa-plus' name='novaDisciplina'>Nova disciplina</a></p>
                <div class="table-wrapper">
                    <table>
                        <thead>
                            <tr>
                                <th>Disciplina</th>
                                <th>Editar</th>
                                <th>Excluir</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach ($disciplinas as $disciplina)
                                <tr>
                                    <td>{{ $disciplina->nome }}</td>
                                    <td><a href="/administrador/disciplinas/editar/{{ $disciplina->id }}">Editar</a></td>
                                    <td><a href="/administrador/disciplinas/deletar/{{ $disciplina->id }}">Excluir</a></td>
                                </tr>
                            @endforeach
                        </tbody>

                        {
                            return '\administrador/configuracoes'
                        }

                    </table>
                </div>
            </div>

2 answers

2

After the registration deletion procedure you can use the helper

back() defined in Laravel.

See the function documentation here.

return back();

Which will return to the same source page.

0

return redirect(/pagina que você quer)
  • 6

    Could you explain better how this response can be applied?

  • If you are making a registration, and after finalized want to return to the form page without the POST, use this.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.