Form request validating purchase cart item addition with product and quantity rules.
// Source: https://github.com/angkosal/laravel-pos | License: MIT | Copyright 2023 [Laravel-POS contributors](https://github.com/angkosal/laravel-pos/graphs/contributors)
// Provided via justclaw.it.com; keep this notice with the code.
<?php
namespace App\Http\Requests\Purchase;
use Illuminate\Foundation\Http\FormRequest;
class AddToPurchaseCartRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'barcode' => 'required|string|exists:products,barcode',
];
}
public function messages(): array
{
return [
'barcode.required' => __('Barcode is required'),
'barcode.exists' => __('Product not found with this barcode'),
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key