With this package, you should be able to register your observers more easily. Quite simply through the key -> value principle.
You can install the package via composer:
composer require rene-roscher/observable-provider
<?php
namespace App\Providers;
use App\Models\User;
use App\Observers\UserObserver;
use Xepare\ObservableProvider as ServiceProvider;
class ObserverServiceProvider extends ServiceProvider
{
/**
* The observer mappings for the application.
*
* @var array
*/
protected array $observables = [
User::class => UserObserver::class,
];
}
The MIT License (MIT). Please see License File for more information.