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.

Why you shouldn’t set global variables in Base Controller

Laravel Daily posted a new tip today, they explain why you shouldn’t set global variables in Base Controller.

Setting global variables in the base controller works, until you need to add a error page or 404 page. When rendering those pages no controller will ever be hit. So your global variables are not available at that moment.

For the workaround I suggest you take a look at the original article on the Laravel Daily site.

Passing variables by Value vs. by Reference Visual Explanation

Penjee released a in depth tutorial that explains the difference between passing by value and by reference.

When writing software code, you will spend a lot of time defining, reading and changing variables. Using a variable means you use a descriptive word in your code which holds some information (a number, some text, an object, etc.). This descriptive word is the “title” of the stored information