TobiasLounsbury / EmpireSkillTest

0 stars 0 forks source link

Nitpick: Using resources would clean this block of code up. #6

Open djfrailey opened 4 years ago

djfrailey commented 4 years ago

The referenced block of code could be cleaned up with the use of Laravel's API Resources.

https://github.com/TobiasLounsbury/EmpireSkillTest/blob/9bebb5ebaa5bbde267e03a2ec544b28af9f9c286/app/Http/Controllers/GameController.php#L27-L33

https://laravel.com/docs/5.8/eloquent-resources

EDIT: Added link to code since GitHub didn't carry it over for me 🤷‍♂

TobiasLounsbury commented 4 years ago

Thanks for the link. I was unaware of this pattern and you are correct that it is a great way to clean up that block. I'll read the full documentation for resources when I have time.