alexeymezenin / laravel-best-practices

Laravel best practices
11.25k stars 2.37k forks source link

What about laravel Resources? #119

Open WatheqAlshowaiter opened 2 years ago

WatheqAlshowaiter commented 2 years ago

like when we say php artisan make: resource SomeResouce

should we make them singular, or plural, or in which cAsEs?

alexeymezenin commented 2 years ago

I think it should be singular in StudlyCase, i.e. UserResource

bijaydas commented 2 years ago

How do you manage, if you need to return different keys for a single resource and collection of resources?

spekulatius commented 2 years ago

Usually resources are single-purpose and should only return one set of information @bijaydas. If you got cases in which you tempted to return a large, combined set you should split them up. I hope this helps