Closed jorgemudry closed 2 years ago
It adds the new make:observer command.
make:observer
composer require flipbox/lumen-generator:dev-add_make_observer_command
php artisan make:observer PlainObserver
PlainObserver.php
app/Observers
<?php
namespace App\Observers;
class PlainObserver { // }
4. Create a model observer: ```bash php artisan make:observer UserObserver --model=User
UserObserver.php
use App\Models\User;
class UserObserver { /**
@return void */ public function created(User $user) { // }
/**
@return void */ public function updated(User $user) { // }
@return void */ public function deleted(User $user) { // }
@return void */ public function restored(User $user) { // }
N/A
What does this Pull Request Do?
It adds the new
make:observer
command.How should this be manually tested?
composer require flipbox/lumen-generator:dev-add_make_observer_command
PlainObserver.php
file in yourapp/Observers
directory looking like this:namespace App\Observers;
class PlainObserver { // }
UserObserver.php
file in yourapp/Observers
directory looking like this:namespace App\Observers;
use App\Models\User;
class UserObserver { /**
@return void */ public function created(User $user) { // }
/**
@return void */ public function updated(User $user) { // }
/**
@return void */ public function deleted(User $user) { // }
/**
@return void */ public function restored(User $user) { // }
/**
Any background context you want to provide?
N/A
What are the relevant tickets?
N/A
Any extra info?