Category Archives: Laravel

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 Illuminate\Console\GeneratorCommand. For instance, you want to create make:service. First, create new artisan command by… Read More »

Laravel: Adaptive Attendance

Assalamualaikum, Recently I’ve attended a local event on launching IT products called JomLaunch. But I’m not gonna go details about it – however you can checkout projects submitted in their website and other projects not presented but worthy to mention – I did submit project (Open Payroll). To keep long story short, I met Akif… Read More »

Laravel: Creating Your Own Helpers

Assalamualaikum / Hi, Helpers in Laravel, help you a lot in day-to-day coding with Laravel. But, what if you want to create your helper? and of course, you want to organise it as well. Usually I have my own helpers – see my helpers in Laravel Boilerplate. But before doing that, you need to add… Read More »

Laravel: Organising Your Route Files

Assalamualaikum / Hi, Have you ever having hundred or probably thousand line of codes in a single routes/web.php ? So, my solution is quite simple. First thing, let’s look at this code snippet: So, it’s quite straightforward - the code above will simply require all files in the routes/web directory. Means that, you can have infinite number of… Read More »

Laravel: CRUD Breadcrumb

Assalamualaikum & Hi, Today, I just want to share a little tip on managing your breadcrumb when using Laravel Breadcrumbs. It is common to have following breadcrumb setup: Main Menu > Module Main Menu > Module > Create Main Menu > Module > Edit Main Menu > Module > Details And it is kind of… Read More »

Laravel: Display Progress Bar in Seeder

Assalamualaikum / Hi, Recent projects development require me to have numbers of seeders – this include some dummy data. Each time seeding new / old data, it’s kinda boring to wait it’s done. So I just need to know, how much the progress of the seeding. Following is the trait I’ve created to generate the… Read More »

Laravel: Reset Password From an API

Assalamualaikum, Today, will share about how to reset your account in Laravel application from an API. This is assumed you already setup JWT Auth in your Laravel app. Create a new API controller – php artisan make:controller Api/Auth/ForgotPasswordController and copy paste the following code, and add the forgot password route in routes/api.php. So, basically what… Read More »

Laravel: HasDatatable Trait

Assalamualaikum, Just a simple setup on datatable – to have a trait that can be use for other models. Assumed that you already install Yajra Datatable, we going to setup the API end point, simplify the setup of datatable. Here the trait: You can use the protected $datatable property to select which fields to display… Read More »

Laravel: Observer Setup Enhancement

Assalamualaikum, It’s been awhile since my last blog post. Today, just want to share something simple, an enhancement of LARAVEL: CREATE HASHED ID FOR A RESOURCE USING OBSERVER. Going to refactor a bit. First, let’s modify the app/Observers/Kernel.php, to be like the following: Next, add new config file for our observer – config/observers.php: And that’s… Read More »