June 15, 2020
AS Refactor
Laravel Request Validation Class for each entity
https://medium.com/@konafets/a-better-place-for-your-validation-rules-in-laravel-f5e3f5b7cc
https://laraveldaily.com/how-to-re-use-the-same-formrequest-class-for-both-store-and-update-actions/
Implement the service architecture, for example:
- the most important thing and what any addon starts with is getting the jwt token and decoding it, extracting the accounttid, saving the jwtClient and Tenant to variables. We can make AtlassianService class, this will be the most important class that the child classes will extend.
- create a ModelService that will contain methods for interacting with the database (write in it the methods that will be needed for each specific service):
ModelService extends AtlassianService
CompanyService extends ModelService
and then call the service methods in controller actions
in routes, replace modelId everywhere with the entity name, for example:
Route::get('/addresses/{modelId}', 'AddressController@show') -> Route::get('/addresses/{address}', 'AddressController@show')
and then in controller:
public function show(Request $request, Address $address)
$address will be a specific model (it only remains to determine that this model belongs to the current Tenant)