src/Observers/BaseObserver.php
private function logEventsToFile($model)
    {
        $user = auth()->user();
        $class = class_basename($model);
        $trace = debug_backtrace();
        $event = $trace[2] ? $trace[2]['function'] : "Unknown event";

        if (auth()->check()) {
            Log::info("{$class} id {$model->id} {$event} by user id {$user->id} ({$user->email}).");
        } else {
            Log::info("{$class} id {$model->id} {$event} by unknown user.");
        }
    }
private function logEventsToFile($model)
    {
        $user = auth()->user();
        $class = class_basename($model);
        $trace = debug_backtrace();
        $event = $trace[2] ? $trace[2]['function'] : "Unknown event";

        if (auth()->check()) {
            Log::info("{$class} id {$model->id} {$event} by user id {$user->id} ({$user->email}).");
        } else {
            Log::info("{$class} id {$model->id} {$event} by unknown user.");
        }
    }
private function logEventsToFile ( $ model ) { $ user = auth ( ) -> user ( ) ; $ class = class_basename ( $ model ) ; $ trace = debug_backtrace ( ) ; $ event = $ trace [ 2 ] ? $ trace [ 2 ] [ 'function' ] : "Unknown event" ; if ( auth ( ) -> check ( ) ) { Log :: info ( "{$class} id {$model->id} {$event} by user id {$user->id} ({$user->email})." ) ; } else { Log :: info ( "{$class} id {$model->id} {$event} by unknown user." ) ; } }
Log Events to file.

@param $model The Eloquent model.
Log Events to file .