v0.1.1 2018-10-11 19:38 UTC

This package is auto-updated.

Last update: 2024-04-24 10:54:35 UTC


This package will automatically make sure that all models that have an observer are booted via Model::observe(Observer::class)

The service provider will look for models with a matching observer class in the observer namespace that follow the naming convention:

Model Class Name Observer Class Name
Example ExampleObserver

See Laravel's Observer Documentation


Via Composer

$ composer require taylornetwork/model-observers

Publish Config

$ php artisan vendor:publish --provider="TaylorNetwork\ModelObservers\ModelObserverServiceProvider"

Will publish config/model-observers.php


If you keep your models under a different namespace than App you will need to change the model_namespace key in config/model-observers.php

Create an Observer

To create an observer, you can use Laravel's built-in make:observer command.

See Laravel's Observer Documentation

Note: this package will register the newly created observer automatically