/** * Register the service provider. * * @return void */ public function register() { //CallingLog CallingLog::created(function ($callingLog) { UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'CallingLog_callingLog', 'reference_id' => $callingLog->id]); }); CallingLog::updated(function ($callingLog) { UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'CallingLog_callingLog', 'reference_id' => $callingLog->id]); }); CallingLog::deleted(function ($callingLog) { UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'CallingLog_callingLog', 'reference_id' => $callingLog->id]); }); }