Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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);
    }

Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #observer #laravel
ADD COMMENT
Topic
Name
8+4 =