jeudi 1 février 2018

Laravel 5 - How can I pass html data to view

I'm trying to return those <i></i> tags to view, how can I render it in blade?

I tried this and this {!! $message !!}

Controller

    $model_filial = new Filial();
    $alerts = [];
    if (!$model_filial->hasEmail($request->codigoempresa, $user->codigofilial)) {
        $filial = $model_filial->getFilial($request->codigoempresa, $user->codigofilial);
        $alerts[] = [
            'message' => "Não foi possivel enviar o e-mail pois a filial <i>".name_case($filial->nome)."</i> não possui um e-mail cadastrado",
            // --------------------------------------- HERE IS THE TAGS ^^^^^ ------------------------ ^^^^^^ --------------------------------
            'classes' => 'alert-danger'
        ];
    } else {
        $mail = new NewCotacao($request->codigoempresa, $codigocotacao);
        Mail::to('suporte9@siacomsistemas.com.br')->send($mail);
    }

View Here I removed some code unnecessary for you guys, but I just show, alert, success, fails message, in alert message I need to render the <i> tag

<div id="content">
        @if(session()->has('alerts'))
            <div class="alert-wrapper">
                @if(session()->has('alerts'))
                    @foreach(session('alerts') as $alert)
                        <div class="alert ">
                       <!-- HERE IS WHERE I'M SHOWING THE MESSAGE -->
                            <p>{!! $alert['message'] !!}</p>
                            <span class="fonticon fonticon-close alert-close"></span>
                        </div>
                    @endforeach
                @endif
                <p class="alert alert-info alert-saving" style="display: none"><i class="fonticon fonticon-loading"></i>
                    Salvando...</p>
            </div>
        @else
            <div class="alert-wrapper">
                <p class="alert alert-info alert-saving" style="display: none"><i class="fonticon fonticon-loading"></i>
                    Salvando...</p>
            </div>
        @endif
        @yield('content')
    </div>

How it shows enter image description here



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire