TIF_NGANJUK_E41220418/app/Http/Requests/User/BookingFotoRequest.php

53 lines
1.9 KiB
PHP

<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class BookingFotoRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'id_paket' => 'required|exists:paket_fotos,id_paket',
'tgl_booking' => 'required|date|after_or_equal:today',
'jam_mulai' => 'required',
'nama' => 'required|string|min:3|max:100|regex:/^[a-zA-Z\s]+$/',
'no_wa' => 'required|numeric|digits_between:10,15',
'bukti_bayar' => 'required|image|mimes:jpeg,png,jpg|max:2048',
];
}
public function messages(): array
{
return [
'required' => 'Kolom :attribute wajib diisi.',
'image' => ':attribute harus berupa file gambar.',
'max' => 'Ukuran :attribute maksimal adalah 2MB.',
'string' => 'Input :attribute harus berupa teks valid.',
'min' => ':attribute terlalu pendek, minimal :min karakter.',
'numeric' => ':attribute harus berupa angka.',
'digits_between' => ':attribute harus antara :min sampai :max digit.',
'date' => 'Format tanggal pada :attribute tidak valid.',
'after_or_equal' => ':attribute tidak boleh tanggal yang sudah lewat.',
'mimes' => 'Format :attribute harus jpeg, png, atau jpg.',
'bukti_bayar.max' => 'Ukuran :attribute maksimal adalah 2MB.',
'regex' => ':attribute hanya boleh berisi huruf dan spasi.',
];
}
public function attributes(): array
{
return [
'nama' => 'nama pemesan',
'no_wa' => 'nomor WhatsApp',
'bukti_bayar' => 'bukti pembayaran',
];
}
}