File: D:/HostingSpaces/SBogers10/blije-gasten.komma.pro/app/Komma/Shop/Orders/SearchRequest.php
<?php
namespace App\Komma\Shop\Orders;
use App\Komma\Shop\Orders\Models\Order;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
/**
* Class SearchRequest
*
* @package App\Komma\Shop\Orders
*/
class SearchRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return \Auth::user()->can('search', Order::class);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
* @throws \ReflectionException
*/
public function rules()
{
return [
'page_id' => 'sometimes|numeric',
'per_page' => 'sometimes|numeric',
'first_name' => 'present|string',
'last_name' => 'present|string',
// 'email' => 'present|email|exists:users,email',
'email' => 'present|string',
'company' => 'present|string',
'street' => 'present|string',
'house_number' => 'present|string',
'postal_code' => 'present|string',
'status' => [
'present',
Rule::in(array_merge(OrderStatus::getAsArray(), ['each']))
]
];
}
/**
* Get custom messages for validator errors.
*
* @return array
*/
public function messages()
{
return __('shop/orders.validation_messages');
}
}