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

[5.7] Enable passing options to custom presets #25930

Merged
merged 2 commits into from
Oct 5, 2018
Merged

[5.7] Enable passing options to custom presets #25930

merged 2 commits into from
Oct 5, 2018

Conversation

connectkushal
Copy link
Contributor

@connectkushal connectkushal commented Oct 4, 2018

The ability to create our own presets is very convenient. But currently it is not possible to have customization in the user made preset commands by passing options to it. For example if i am making a preset for tachyon css and want the dev to choose a js framework from either vue or react along with the choice of creating auth pages or not, its not possible with php artisan preset tachyon alone.

This pr enables passing of multiple values to the custom presets through --option=, which can be used as ...
php artisan preset tachyon --option=vue --option=cdn --option=version:4.0 or
php artisan preset tachyon --option=react --option=auth
.
This opens many possibilities for creating presets which will simplify and make frontend dev much faster.

This is a non breaking change and works as intended without affecting the default presets.


The array of values passed can be accessed in the following way.

PresetCommand::macro('tachyon', function($command){
    $options =  $command->option('option'), 
    ....
    ....
});

Currently it is not possible to create custom presets with customization
@taylorotwell
Copy link
Member

Why not just something like option?

@connectkushal
Copy link
Contributor Author

connectkushal commented Oct 4, 2018

@taylorotwell i'll update the description and name if option seems more appropriate.

@taylorotwell
Copy link
Member

I would prefer option over pass.

@connectkushal
Copy link
Contributor Author

connectkushal commented Oct 4, 2018

@taylorotwell done

@taylorotwell taylorotwell merged commit 25f8840 into laravel:5.7 Oct 5, 2018
@connectkushal connectkushal deleted the patch-1 branch October 5, 2018 15:13
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