Export php variables to javascript

Spatie, known for their Laravel packages, released a brand new package. Laravel blade javascript is a Blade directive to export PHP variables to Javascript.

But instead of exporting variables in the controller our package does it in the view.

Read the full article on Freek Van der Herten his blog. You can also find all the other Spatie packages on their website.

New migration and blade features coming to Laravel 5.3

Taylor Otwell announced two new features coming to Laravel 5.3 on twitter today.  You will be able to roll back one migration at a time and you will have access to the $loop variable in blade foreach loops.

Rolling back one migration at a time

This new feature will come in handy when one of your migrations fail for some reason. You will be able to use it this way:

php artisan migrate:rollback --step=1


Blade $loop variable

In blade foreach loops you will have access to a $loop variable, it will allow you to do things like this, but knowing Taylor there will be a lot more available.

@foreach($users as $user)
    @if($loop->first)
        <!-- First iterartion -->
    @endif
    
    @if($loop->last)
        <!-- Last iteration -->
    @endif
@endforeach


Code credits go to Taylor Otwell & Laravel php