First we will create a custom command which we will run to demonstrate the logging
php artisan make:command CustomCommand
Also we will create a model and migration file together
php artisan make:model -m CommandLog
Then, just need to listen to the CommandFinished event which runs after every command and insert the log using the model. Please go throw the files below.