Skip to content

PHP code snippet – How to make observer in laravel?

make observer by follow command in Artisan:
----------------------------------------------
 php artisan make:Observer ProductObserver --model=<put here path of your Model>

   
then in app/providers/EventServiceProvider.php at boot Methode write follow code:
----------------------------------------------------------------------------------
  public function boot()
    {
        Product::observe(ProductObserver::class);
    }

See also  Python code snippet - How to serach for multiple attributes in xpath selenium ?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.