mardi 1 mars 2016

Laravel 5 laracasts flash messaging not showing error div

I've been trying to get a flash message letting the user know that their message from the contact form has successfully been sent, I found This Github Repo in which there's an "easy" way of flashing error messages in Laravel 5 (I'm using Laravel 5.2) so I went on an tried using it, but I can't seem to get it to work.

The classes are all being found, the problem here is that it won't flash after I redirect.

In my master.blade.php

@if (Session::has('flash_notification.message'))
<div class="alert alert-{{ Session::get('flash_notification.level') }}">
    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>

    {{ Session::get('flash_notification.message') }}
</div>
@endif

In my routes.php

Route::post('sendemail', function () {

    $data = array(
        'name' => "Learning Laravel",
    );

    Mail::send('emails.welcome', $data, function ($message) {

        $message->from('mike.donkers1@gmail.com', 'Learning Laravel!');

        $message->to('donkers.mbj@gmail.com')->subject('Learning Laravel test email');

    });
        Flash::message('Thank you for contacting us, we will get back to you as soon as possible.');

        return Redirect::to('/');

});

What am I doing wrong / forgetting?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1REEwTw
via IFTTT

Aucun commentaire:

Enregistrer un commentaire