78 lines
3.4 KiB
PHP
78 lines
3.4 KiB
PHP
<?php
|
|
|
|
namespace Modules\Setting\app\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Support\Arr;
|
|
|
|
class CreateOrUpdateGeneralSettingRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'primary_image' => 'nullable|image|mimes:jpeg,png,jpg,gif|max:3072',
|
|
'secondary_image' => 'nullable|image|mimes:jpeg,png,jpg,gif|max:3072',
|
|
'company_name' => 'required|string|max:255',
|
|
'address' => 'nullable|string|max:255',
|
|
'contact_number' => 'nullable|string|max:255',
|
|
'info_email_address' => 'nullable|email|max:255',
|
|
'mobile_number' => 'nullable|string|max:255',
|
|
'alt_mobile_number' => 'nullable|string|max:255',
|
|
'support_email_address' => 'nullable|email|max:255',
|
|
'opening_hours' => 'nullable|string|max:255',
|
|
'short_detail' => 'nullable|string',
|
|
];
|
|
}
|
|
|
|
public function messages()
|
|
{
|
|
return [
|
|
'primary_image.image' => 'The primary image must be an image file.',
|
|
'primary_image.mimes' => 'The primary image must be a file of type: jpeg, png, jpg, gif.',
|
|
'primary_image.max' => 'The primary image may not be greater than 3MB.',
|
|
|
|
'secondary_image.image' => 'The secondary image must be an image file.',
|
|
'secondary_image.mimes' => 'The secondary image must be a file of type: jpeg, png, jpg, gif.',
|
|
'secondary_image.max' => 'The secondary image may not be greater than 3MB.',
|
|
|
|
'company_name.required' => 'The company name field is required.',
|
|
'company_name.string' => 'The company name field must be a string.',
|
|
'company_name.max' => 'The company name may not be greater than 255 characters.',
|
|
|
|
'address.string' => 'The address field must be a string.',
|
|
'address.max' => 'The address may not be greater than 255 characters.',
|
|
|
|
'contact_number.string' => 'The contact number field must be a string.',
|
|
'contact_number.max' => 'The contact number may not be greater than 255 characters.',
|
|
|
|
'info_email_address.email' => 'The info email address must be a valid email address.',
|
|
'info_email_address.max' => 'The info email address may not be greater than 255 characters.',
|
|
|
|
'mobile_number.string' => 'The mobile number field must be a string.',
|
|
'mobile_number.max' => 'The mobile number may not be greater than 255 characters.',
|
|
|
|
'alt_mobile_number.string' => 'The alt mobile number field must be a string.',
|
|
'alt_mobile_number.max' => 'The alt mobile number may not be greater than 255 characters.',
|
|
|
|
'support_email_address.email' => 'The support email address must be a valid email address.',
|
|
'support_email_address.max' => 'The support email address may not be greater than 255 characters.',
|
|
|
|
'opening_hours.string' => 'The opening hours field must be a string.',
|
|
'opening_hours.max' => 'The opening hours may not be greater than 255 characters.',
|
|
|
|
'short_detail.string' => 'The short detail field must be a string.',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
}
|