For the following request, when body params are sent as JSON, it always validates the request (as in no validation rule is triggered), but when sent in form-data or form-urlencoded, it passes through validation rules. Is it a limitation with Laravel?
namespace AppApiRequestsOrganizationUser;
use AppApiConstantsPlatformRoles;
use FrameworkHttpRequestsAPIFormRequest;
class CreateNewUserRequest extends APIFormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'bail|required|string|max:255',
'access' => 'present|array',
'access.*.access_type' => ['bail', 'sometimes', 'string'],
'access.*.id' => ['bail', 'sometimes', 'string']
];
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…