Changes output to JSON serialization.

This commit is contained in:
Joao Patricio
2023-04-07 15:58:45 +01:00
parent 2a8d603f98
commit e6f0059e5e
10 changed files with 62 additions and 130 deletions

View File

@@ -15,5 +15,18 @@ use Illuminate\Support\Facades\Artisan;
*/
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
$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');