PHP code example of thomascombe / laravel-observer-attributes

1. Go to this page and download the library: Download thomascombe/laravel-observer-attributes library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

thomascombe / laravel-observer-attributes example snippets


return [
    'directories' => [
        app_path('Models'),
    ],
];

use App\Observers\UserObserver;

#[Observer(UserObserver::class)]
class User extends Authenticatable 
{

}

User::observe(UserObserver::class);

use App\Observers\EntityObserver;
use App\Observers\UserObserver;

#[Observer(UserObserver::class, EntityObserver::class)]
class User extends Authenticatable 
{

}
bash
php artisan vendor:publish --provider="Thomascombe\ObserverAttributes\ObserverAttributesServiceProvider" --tag="laravel-observer-attributes-config"