42 lines
961 B
PHP
42 lines
961 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin\Master\RawMaterial;
|
|
|
|
use App\Concerns\CurrencyStripping;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class RawMaterialVariantRequest extends FormRequest
|
|
{
|
|
use CurrencyStripping;
|
|
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function prepareForValidation(): void
|
|
{
|
|
$this->merge($this->stripCurrencyDot($this->all(), 'price'));
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'variant' => ['required', 'string', 'max:200'],
|
|
'price' => ['required', 'integer', 'min:0'],
|
|
'stock' => ['required', 'integer', 'min:0'],
|
|
'photo_key' => ['required', 'string', 'max:500'],
|
|
];
|
|
}
|
|
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'variant' => 'Nama Varian',
|
|
'price' => 'Harga',
|
|
'stock' => 'Stok',
|
|
'photo_key' => 'Foto',
|
|
];
|
|
}
|
|
}
|