Update source into github
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\Shop;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AddToCartRequest 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.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'product_id' => 'required|integer|min:1',
|
||||
'type_id' => 'required|integer|min:1',
|
||||
'product_price' => 'required|numeric|min:0',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom error messages for validation rules.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'product_id.required' => 'Yêu cầu không hợp lệ!',
|
||||
'product_id.integer' => 'ID sản phẩm không hợp lệ!',
|
||||
'product_id.min' => 'ID sản phẩm không hợp lệ!',
|
||||
'type_id.required' => 'Yêu cầu không hợp lệ!',
|
||||
'type_id.integer' => 'ID loại sản phẩm không hợp lệ!',
|
||||
'type_id.min' => 'ID loại sản phẩm không hợp lệ!',
|
||||
'product_price.required' => 'Giá sản phẩm không được để trống!',
|
||||
'product_price.numeric' => 'Giá sản phẩm phải là số!',
|
||||
'product_price.min' => 'Giá sản phẩm không hợp lệ!',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user