59 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			PHP
		
	
	
			
		
		
	
	
			59 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			PHP
		
	
	
<?php
 | 
						|
 | 
						|
namespace App\Http\Requests;
 | 
						|
 | 
						|
use Illuminate\Foundation\Http\FormRequest;
 | 
						|
 | 
						|
class HukumRequest extends FormRequest
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * Determine if the user is authorized to make this request.
 | 
						|
     */
 | 
						|
    public function authorize(): bool
 | 
						|
    {
 | 
						|
        return true;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Get the validation rules that apply to the request.
 | 
						|
     *
 | 
						|
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
 | 
						|
     */
 | 
						|
    public function rules(): array
 | 
						|
    {
 | 
						|
        return [
 | 
						|
           'PerusahaanId'    => 'nullable|integer',
 | 
						|
            'JenisSanksiId'   => 'nullable|integer',
 | 
						|
            'SanksiNumber'    => 'nullable|string|max:100',
 | 
						|
            'SanksiDate'      => 'nullable|date',
 | 
						|
            'SanksiFile'      => 'nullable|file|mimes:pdf|max:2048',
 | 
						|
            'PenaatanId'  => 'required|integer|in:1,2,3',
 | 
						|
            'PenaatanNumber'  => 'nullable|string|max:100',
 | 
						|
            'PenaatanDate'    => 'nullable|date',
 | 
						|
            'PenaatanFile'    => 'nullable|file|mimes:pdf,jpg,png|max:2048',
 | 
						|
            'IsDeleted'       => 'nullable|boolean',
 | 
						|
        ];
 | 
						|
    }
 | 
						|
 | 
						|
    public function messages(): array
 | 
						|
    {
 | 
						|
        return [
 | 
						|
            'PerusahaanId.integer'   => 'Perusahaan harus berupa angka.',
 | 
						|
            'PerusahaanId.exists'    => 'Perusahaan tidak ditemukan.',
 | 
						|
            'JenisSanksiId.integer'  => 'Jenis Sanksi harus berupa angka.',
 | 
						|
            'JenisSanksiId.exists'   => 'Jenis Sanksi tidak ditemukan.',
 | 
						|
            'SanksiNumber.max'       => 'Nomor SK Sanksi maksimal 100 karakter.',
 | 
						|
            'SanksiDate.date'        => 'Tanggal SK Sanksi harus berupa format tanggal.',
 | 
						|
            'SanksiFile.mimes'       => 'File Sanksi harus berupa PDF',
 | 
						|
            'SanksiFile.max'         => 'Ukuran file maksimal 2MB.',
 | 
						|
            'PenaatanId.required'=> 'Status Penaatan wajib diisi.',
 | 
						|
            'PenaatanId.in'      => 'Status Penaatan hanya boleh 1, 2, atau 3.',
 | 
						|
            'PenaatanNumber.max'     => 'Nomor SK Penaatan maksimal 100 karakter.',
 | 
						|
            'PenaatanDate.date'      => 'Tanggal SK Penaatan harus berupa format tanggal.',
 | 
						|
            'PenaatanFile.mimes'     => 'File Penaatan harus berupa PDF',
 | 
						|
            'PenaatanFile.max'       => 'Ukuran file maksimal 2MB.',
 | 
						|
            'IsDeleted.boolean'      => 'IsDeleted hanya boleh bernilai 0 atau 1.',
 | 
						|
        ];
 | 
						|
    }
 | 
						|
}
 |