121 lines
8.1 KiB
PHP
121 lines
8.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class CompanyRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return Auth::check();
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'company_name' => ['required', 'max:100'],
|
|
'company_email' => ['required', 'max:100', 'email'],
|
|
'company_address' => ['required'],
|
|
'company_director_name' => ['required', 'max:100'],
|
|
'company_director_nik' => ['required', 'max:100'],
|
|
'company_director_nik_doc' => ['nullable', 'file', 'mimes:pdf,jpeg,png,jpg,gif', 'max:2048'],
|
|
'company_deed_incorporation' => ['nullable', 'max:100'],
|
|
'company_deed_incorporation_doc' => ['nullable', 'file', 'mimes:pdf,jpeg,png,jpg,gif', 'max:2048'],
|
|
'company_trade_license' => ['nullable', 'max:100'],
|
|
'company_trade_license_doc' => ['nullable', 'file', 'mimes:pdf,jpeg,png,jpg,gif', 'max:2048'],
|
|
'company_tax_id_number' => ['nullable', 'max:100'],
|
|
'company_tax_id_number_doc' => ['nullable', 'file', 'mimes:pdf,jpeg,png,jpg,gif', 'max:2048'],
|
|
'company_taxable_enterprise' => ['nullable', 'max:100'],
|
|
'company_taxable_enterprise_doc' => ['nullable', 'file', 'mimes:pdf,jpeg,png,jpg,gif', 'max:2048'],
|
|
'company_annual_tax_return' => ['nullable', 'max:100'],
|
|
'company_annual_tax_return_doc' => ['nullable', 'file', 'mimes:pdf,jpeg,png,jpg,gif', 'max:2048'],
|
|
'company_domicile_certificate' => ['nullable', 'max:100'],
|
|
'company_domicile_certificate_doc' => ['nullable', 'file', 'mimes:pdf,jpeg,png,jpg,gif', 'max:2048'],
|
|
'company_profile' => ['nullable', 'max:100'],
|
|
'company_profile_doc' => ['nullable', 'file', 'mimes:pdf,jpeg,png,jpg,gif', 'max:2048'],
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
|
|
// Company
|
|
'company_name.required' => 'Nama perusahaan wajib diisi.',
|
|
'company_name.max' => 'Nama perusahaan maksimal 100 karakter.',
|
|
'company_email.required' => 'Email perusahaan wajib diisi.',
|
|
'company_email.email' => 'Email perusahaan tidak valid.',
|
|
'company_email.max' => 'Email perusahaan maksimal 100 karakter.',
|
|
'company_address.required' => 'Alamat perusahaan wajib diisi.',
|
|
'company_director_name.required' => 'Nama direktur perusahaan wajib diisi.',
|
|
'company_director_name.max' => 'Nama direktur perusahaan maksimal 100 karakter.',
|
|
'company_director_nik.required' => 'NIK direktur perusahaan wajib diisi.',
|
|
'company_director_nik.max' => 'NIK direktur perusahaan maksimal 100 karakter.',
|
|
'company_director_nik_doc.required' => 'Dokumen NIK direktur perusahaan wajib diunggah.',
|
|
'company_director_nik_doc.file' => 'Dokumen NIK direktur perusahaan harus berupa file.',
|
|
'company_director_nik_doc.mimes' => 'Dokumen NIK direktur perusahaan harus dalam format PDF.',
|
|
'company_director_nik_doc.max' => 'Ukuran dokumen NIK direktur perusahaan maksimal 2 MB.',
|
|
|
|
// Documents
|
|
'company_deed_incorporation.max' => 'Akta pendirian perusahaan maksimal 100 karakter.',
|
|
'company_deed_incorporation_doc.file' => 'Dokumen akta pendirian perusahaan harus berupa file.',
|
|
'company_deed_incorporation_doc.mimes' => 'Dokumen akta pendirian perusahaan harus dalam format PDF.',
|
|
'company_deed_incorporation_doc.max' => 'Ukuran dokumen akta pendirian perusahaan maksimal 2 MB.',
|
|
'company_trade_license.max' => 'Lisensi perdagangan perusahaan maksimal 100 karakter.',
|
|
'company_trade_license_doc.file' => 'Dokumen lisensi perdagangan perusahaan harus berupa file.',
|
|
'company_trade_license_doc.mimes' => 'Dokumen lisensi perdagangan perusahaan harus dalam format PDF.',
|
|
'company_trade_license_doc.max' => 'Ukuran dokumen lisensi perdagangan perusahaan maksimal 2 MB.',
|
|
'company_tax_id_number.max' => 'Nomor NPWP perusahaan maksimal 100 karakter.',
|
|
'company_tax_id_number_doc.file' => 'Dokumen NPWP perusahaan harus berupa file.',
|
|
'company_tax_id_number_doc.mimes' => 'Dokumen NPWP perusahaan harus dalam format PDF.',
|
|
'company_tax_id_number_doc.max' => 'Ukuran dokumen NPWP perusahaan maksimal 2 MB.',
|
|
'company_taxable_enterprise.max' => 'Nomor PKP perusahaan maksimal 100 karakter.',
|
|
'company_taxable_enterprise_doc.file' => 'Dokumen PKP perusahaan harus berupa file.',
|
|
'company_taxable_enterprise_doc.mimes' => 'Dokumen PKP perusahaan harus dalam format PDF.',
|
|
'company_taxable_enterprise_doc.max' => 'Ukuran dokumen PKP perusahaan maksimal 2 MB.',
|
|
'company_annual_tax_return.max' => 'Laporan SPT tahunan perusahaan maksimal 100 karakter.',
|
|
'company_annual_tax_return_doc.file' => 'Dokumen SPT tahunan perusahaan harus berupa file.',
|
|
'company_annual_tax_return_doc.mimes' => 'Dokumen SPT tahunan perusahaan harus dalam format PDF.',
|
|
'company_annual_tax_return_doc.max' => 'Ukuran dokumen SPT tahunan perusahaan maksimal 2 MB.',
|
|
'company_domicile_certificate.max' => 'Sertifikat domisili perusahaan maksimal 100 karakter.',
|
|
'company_domicile_certificate_doc.file' => 'Dokumen sertifikat domisili perusahaan harus berupa file.',
|
|
'company_domicile_certificate_doc.mimes' => 'Dokumen sertifikat domisili perusahaan harus dalam format PDF.',
|
|
'company_domicile_certificate_doc.max' => 'Ukuran dokumen sertifikat domisili perusahaan maksimal 2 MB.',
|
|
'company_profile.max' => 'Profil perusahaan maksimal 100 karakter.',
|
|
'company_profile_doc.file' => 'Dokumen profil perusahaan harus berupa file.',
|
|
'company_profile_doc.mimes' => 'Dokumen profil perusahaan harus dalam format PDF.',
|
|
'company_profile_doc.max' => 'Ukuran dokumen profil perusahaan maksimal 2 MB.',
|
|
];
|
|
}
|
|
|
|
protected function prepareForValidation()
|
|
{
|
|
$this->merge([
|
|
'company_deed_incorporation' => filled($this->company_deed_incorporation) ? $this->company_deed_incorporation : null,
|
|
'company_deed_incorporation_doc' => filled($this->company_deed_incorporation_doc) ? $this->company_deed_incorporation_doc : null,
|
|
'company_trade_license' => filled($this->company_trade_license) ? $this->company_trade_license : null,
|
|
'company_trade_license_doc' => filled($this->company_trade_license_doc) ? $this->company_trade_license_doc : null,
|
|
'company_tax_id_number' => filled($this->company_tax_id_number) ? $this->company_tax_id_number : null,
|
|
'company_tax_id_number_doc' => filled($this->company_tax_id_number_doc) ? $this->company_tax_id_number_doc : null,
|
|
'company_taxable_enterprise' => filled($this->company_taxable_enterprise) ? $this->company_taxable_enterprise : null,
|
|
'company_taxable_enterprise_doc' => filled($this->company_taxable_enterprise_doc) ? $this->company_taxable_enterprise_doc : null,
|
|
'company_annual_tax_return' => filled($this->company_annual_tax_return) ? $this->company_annual_tax_return : null,
|
|
'company_annual_tax_return_doc' => filled($this->company_annual_tax_return_doc) ? $this->company_annual_tax_return_doc : null,
|
|
'company_domicile_certificate' => filled($this->company_domicile_certificate) ? $this->company_domicile_certificate : null,
|
|
'company_domicile_certificate_doc' => filled($this->company_domicile_certificate_doc) ? $this->company_domicile_certificate_doc : null,
|
|
'company_profile' => filled($this->company_profile) ? $this->company_profile : null,
|
|
'company_profile_doc' => filled($this->company_profile_doc) ? $this->company_profile_doc : null,
|
|
]);
|
|
}
|
|
}
|