Redirect and Route in Laravel 5.5, is it possible?

I am having a beginner difficulty here in my training with Laravel 5.5 I just created an update - Update method,

public function atualizar(Request $request, $id)
{
    $dados = $request->all();

    if(isset($dados['situacao']))
    {
        $dados['situacao'] = "Ativa";
    }
    else
    {
        $dados['situacao'] = "Inativa";
    }

    Empresa::find($id)->update($dados);

    $mensagem = "Empresa altera com sucesso!";
    return redirect()->route('admin.empresas')->with('mensagem', $mensagem);
}

The update is being performed correctly, but the message is not being returned to the screen for an alert. This redirect I'm using is not this correct?

Valeu.

Author: Regis Andrade, 2019-03-18

1 answers

After exchanging several messages with @ Virgilio, I resolved as follows:

In the control I put the following Return:

return redirect()->route('admin.empresas')->with('mensagem', $mensagem);

Already in the View, I performed the following check:

@if (Session::has('mensagem'))
   <div class="alert alert-success" role="alert">{{Session::get('mensagem')}</div>
@endif
 1
Author: Regis Andrade, 2019-03-18 21:06:25