Register the observer to model in boot()
method in your app/Providers/AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
\App\User::observe(\App\Observers\HashidsObserver::class);
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}