Skip to content

gpanos/laravel-observe-attribute

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP 8 attribute to register Laravel model observers.

tests code style

Instead of defining observers inside service providers this package offers an alternative way to register model observers for your Laravel applications.

Inspired by spatie/laravel-route-attributes

Installation

composer require gpanos/laravel-observe-attribute

Usage

To register an observer add the Observe attribute to your model and pass it your observer class.

<?php

#[Observe(UserObserver::class)]
class User extends Authenticatable
{
    ...
}

About

Register model observers using php 8 attributes

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages