Category Archives: Laravel

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 »

Laravel: Minify HTML

Assalamualiakum / Hi, Just a quick blog post this time. As part of optimisation, it’s important to minify your JavaScript & CSS – this can be done with Laravel Mix. But how about HTML? Seen this? So that’s how it’s look like our generated HTML codes. And how we going to change into this? A… Read More »