UserRequest
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class EmployeeRequest extends FormRequest
{
/**
* 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<string, mixed>
*/
public function rules()
{
return [
'first_name'=>'required|string',
'last_name'=>'required|string',
'email'=>'required|email|unique:employees,email',
'contact_number'=>'required|numeric',
'date_of_birth'=>'required',
'current_address'=>'required',
'pan_number'=>'required|numeric',
'bank_account_number'=>'required',
'avatar'=>'required|image|mimes:jpeg,png',
'documents'=>'required',
'documents.*'=>'max:5000|mimes:pdf,png,jpeg',
];
}
public function messages()
{
return [
'avatar.image'=> "Invalid image format",
'documents.max' => "Error uploading file:File too big.Max file size:5MB",
];
}
}
I am trying to create an API where when a user enters a file/n number of files or image whose size is more than 5MB I want to throw a custom validation message but it shows Warning: POST Content-Length of 16043214 bytes exceeds the limit of 8388608 bytes in Unknown on line in postman. Does anyone have any idea regarding this? I am using docker to run the server and any help will be really appreciated.