Skip to content

[9.x] Support closures as values for about command - #43225

Merged
taylorotwell merged 1 commit into
laravel:9.xfrom
SamuelMwangiW:artisan-about-closure
Jul 18, 2022
Merged

[9.x] Support closures as values for about command#43225
taylorotwell merged 1 commit into
laravel:9.xfrom
SamuelMwangiW:artisan-about-closure

Conversation

@SamuelMwangiW

@SamuelMwangiW SamuelMwangiW commented Jul 17, 2022

Copy link
Copy Markdown
Contributor

What

The PR proposes to support closures as values for the about command e.g

AboutCommand::add('Settings', [
    'value' => fn() => SettingModel::first()->value,
    'App Balance' => fn() => BalanceService::fetch(),
    'Computed Metric' => fn() => 6 ÷ 2(2+1),
]);

Why

I can see how handy to delay computation of some metrics and not have to evaluate the same with every request.
Also since its intended that Packages would be able to add sections to about command output

Tests

I couldn't find tests from the inital PR to add to but can add if requested.

Thanks for the great work

@SamuelMwangiW SamuelMwangiW changed the title Support closures as values [9.x] Support closures as values for about command Jul 17, 2022
@SamuelMwangiW
SamuelMwangiW marked this pull request as ready for review July 17, 2022 01:50
@taylorotwell
taylorotwell merged commit b3b6f5b into laravel:9.x Jul 18, 2022
@SamuelMwangiW
SamuelMwangiW deleted the artisan-about-closure branch July 18, 2022 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants