Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Jul 18, 2022

Conversation

SamuelMwangiW
Copy link
Contributor

@SamuelMwangiW SamuelMwangiW commented Jul 17, 2022

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.

None yet

2 participants