Author : lovecoding

Laravel Version: 7.14.1 Here is my Email Model. class Email extends Model { public static function boot() { parent::boot(); static::updated(function($obj) { Log::info(‘1-‘.$obj->status); if($obj->status===’active’) { Log::info(‘2-‘.$obj->status); $obj->sendCampaign(); } }); } public function sendCampaign() { $campaign = $this; dispatch(new SendEmailJob($campaign )); $campaign->status=’sent’; $campaign->save(); Log::info(‘3-‘ . $campaign->status); } } ##old status was sent. and I just updated it ..

Read more