I am using laravel 8.
I want to store a model called "domain". A domain belongs to an organization.
I use this route :
Route::apiResource('organizations/{organization}/domains', DomainController::class)->whereUuid(['organization', 'domain']);
As the route is :
{{path}}/organizations/1a52ef80-9f9e-4172-9d8c-e63595ad3712/domains
I have 2 choices to send the data to the server. I can post something like that :
{
"organization_id": "1a52ef80-9f9e-4172-9d8c-e63595ad3712",
"domain_name": "domain name"
}
or without the organization_id since it is in the path.
{
"domain_name": "domain name"
}
What is a good pratice ? With or without the parent in the json ?