52 lines
1.9 KiB
PHP
52 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin\Manage;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class CuttingRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'description' => ['nullable', 'string', 'max:100'],
|
|
'product_name' => ['required', 'string', 'max:255'],
|
|
'sample' => ['required', 'integer'],
|
|
'original_outside_sample' => ['required', 'integer'],
|
|
'cutting_result' => ['required', 'integer', 'min:1'],
|
|
'materials' => ['required', 'array', 'min:1'],
|
|
'materials.*.raw_material_price_id' => ['required', 'integer', 'exists:raw_material_prices,id'],
|
|
'materials.*.material_usage' => ['required', 'integer', 'min:1'],
|
|
'materials.*.material_result' => ['required', 'integer'],
|
|
'materials.*.combination_index' => ['nullable', 'integer'],
|
|
'combinations' => ['nullable', 'array'],
|
|
'combinations.*.material_result' => ['nullable', 'integer'],
|
|
'photo_key' => ['nullable', 'string', 'max:500'],
|
|
];
|
|
}
|
|
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'description' => 'Keterangan',
|
|
'product_name' => 'Nama Produk',
|
|
'sample' => 'Sample',
|
|
'original_outside_sample' => 'Diluar Sample',
|
|
'cutting_result' => 'Hasil',
|
|
'materials' => 'Bahan Baku',
|
|
'materials.*.raw_material_price_id' => 'Varian Bahan Baku',
|
|
'materials.*.material_usage' => 'Pemakaian',
|
|
'materials.*.material_result' => 'Hasil Material',
|
|
'materials.*.combination_index' => 'Indeks Kombinasi',
|
|
'combinations' => 'Kombinasi',
|
|
'combinations.*.material_result' => 'Hasil Kombinasi',
|
|
'photo_key' => 'Foto',
|
|
];
|
|
}
|
|
}
|