lasthourcloud/routes/console.php
2023-04-07 15:58:45 +01:00

33 lines
886 B
PHP

<?php
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
/*
|--------------------------------------------------------------------------
| Console Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of your Closure based console
| commands. Each Closure is bound to a command instance allowing a
| simple approach to interacting with each command's IO methods.
|
*/
Artisan::command('inspire', function () {
$activity = Spatie\Activitylog\Models\Activity::latest()->first();
$this->info(
collect(
json_decode(data_get($activity, 'description'), associative: true, flags: JSON_THROW_ON_ERROR)
)
->sortBy('order')
->map(fn($i) => $i['output'])
->implode("\n")
);
})->purpose('Display an inspiring quote');