-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
Artisan commands for registering existing models as reactants/reacters #127
Artisan commands for registering existing models as reactants/reacters #127
Conversation
Seems like style-ci is not configured properly? |
I think CI issue happens because Laravel changed code style recently. |
I've fixed StyleCI in #128 |
I've reviewed only one class quickly. With following fixes StyleCI will add more issues in this list. |
There should be an ability to resolve model class name from the morph map: php artisan love:register-reacters user You can see how it's implemented in Recount command. |
Sorry, personal coding style habits in action there :) I'll address when I have the time. |
Just noticed command naming issue. |
Ok, cool. I will adjust that as well. I am out of the office until tomorrow, but will get back on it soon. |
@sburkett I've refactored your implementation. Tried to make it clean and as simple as possible. |
Final APIRegister models as ReactantsUsing fully qualified class name$ php artisan love:register-reactants --model="App\Article" Using morph map$ php artisan love:register-reactants --model=article Specify ids delimited with comma$ php artisan love:register-reactants --model="App\Article" --ids=1,4,25 Specify ids using option array$ php artisan love:register-reactants --model="App\Article" --ids=1 --ids=4 --ids=25 Register models as ReactersUsing fully qualified class name$ php artisan love:register-reacters --model="App\User" Using morph map$ php artisan love:register-reacters --model=user Specify ids delimited with comma$ php artisan love:register-reacters --model="App\User" --ids=1,4,25 Specify ids using option array$ php artisan love:register-reacters --model="App\User" --ids=1 --ids=4 --ids=25 |
Fairly straightforward. These two artisan commands can be invoked to register any or all existing model rows for reactants or reacters. Both commands accept the same parameters, as outlined below.
Command Help
Here is the output of artisan help for the
love:register-reactant
command (the reacter command follows a similar pattern):Use Cases
Process all records for the passed model:
Process specific records for the passed model:
Sample output (yes, I love progress bars lol):
Feel free to merge and make any changes or tweaks that you feel necessary.