Category Archives: Artisan

Laravel: Write Class Generator Command

Assalamualaikum, In this post, I will share with you how you can create your own class generator – like php artisan make:model …. So here the trick, in order to create your own class generator command, you can extend the use IlluminateConsoleGeneratorCommand. For instance, you want to create make:service. First, create new artisan command by… Read More »

Laravel: Observer

Assalamualaikum & Hi, Eloquent models fire several events, allowing you to hook into the following points in a model’s lifecycle: retrieved, creating, created, updating, updated, saving, saved, deleting, deleted, restoring, restored. Events allow you to easily execute code each time a specific model class is saved or updated in the database. Based on events above,… Read More »

How to Use Lumen in Laravel

You love the speed of Lumen but you want to have the features of Laravel? No problem, just include Lumen inside Laravel! Below are the steps to include Lumen inside of the Laravel Please ensure to create an empty Laravel and Lumen project because you need to copy some files from Lumen to Laravel Here… Read More »

Laravel: How to Create Custom Artisan Command

There’s only 3 steps required to setting up new Artisan command. Step 1 – Create a new console file Step 2 – Open up app/Console/Commands/CommandName.php and update the signature and the description property. Step 3 – Register your new Artisan command in app/Console/Kernel.php Now you’re ready with your new artisan command. Check your command with… Read More »