Nasrul Hazim Bin Mohamad

Laravel: Observer Setup Enhancement

Apr
24

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 it!

Very simple and straightforward setup of Laravel Observer, much cleaner than before.

Should I make this as a package? Do let me know if you guys need this as a package. 🙂

Thanks

Laravel: Activation Account by E-mail – Part 1

Jan
13

From previous post, we extend the usage of Notifications, Event and Listener to have a mechanism where user need to activate their account in order to use the application.

In this Part 1, we just setup the Notification, Event and Listener. Part 2 will be about how do we check if user already activate their account or not.

Laravel: Create Welcome Email

Jan
13

A quick post on how to setup a welcome email on user registration.

Make sure you have a mailtrap.io account for testing purpose, or production you may use SparkPost, or GMail SMTP, or any provider should work with proper .env on mail configuration.

OpenLayers – Capture Layer Visibility Changes

Jan
15

Solution: Use `changelayer` event to capture layer visibility changes.

map.events.register('changelayer', null, function (e)
{
	if (e.property === 'visibility')
	{
		// do something
	}
}
);