Global view data for all actions in Laravel Blade

Laravel’s Blade is a great templating system that blends with Laravel’s ecosystem very well. Setting some data to the view is a breeze and rendering those data into the template is ever so easy. For instance, if you would like to share some data from a controller’s action to a view, you’d do like so.

» Read More

Add additional attributes in request in Laravel

Sometimes, you might want to attach additional attributes to the original request that has made to the Laravel application. For instance, you want to put your own check in the middleware to see if the user is permitted to access the page or not, and pass that “check” by attaching it as an additional attribute to the request.

» Read More

My Coding Playlist

Music had always played a important role throughout the evolution of the mankind. Programming is certainly no different.

» Read More

Little trick to loop through class properties in PHP

There’s this little trick in PHP that I got to know about today. The trick basically is, you can loop through all the class properties having the “public” visibility just by iterating over the class object using loop construct such as foreach.

» Read More

Verify if email is from a valid domain in PHP

Working on an application which received user signups and let’s suppose it’s built on top of PHP, you want to validate that the email the user enters is valid. Sure, you’ll check that the email entered is a “syntactically” valid one by using one of these methods.

» Read More

This blog is my playground

I started this website to establish my web presence on the holy internet. I wanted to keep a portfolio of my projects and to blog about random stuff(very rarely). Back then, I was only used to post articles whenever I feel like. But then, something’s changed.

» Read More

Using objects as arrays (with a real world example) in PHP

Sometimes, it’s convenient when you could get to access class objects as arrays. For instance, the time when one of the class properties is of type array and you want to manipulate it just like you’d do with an array without exposing it during object creation. I’ve included a real world example of where this could be useful, at the end of the article. So, read on!

» Read More