Example:
<?php
namespace Aero\Store\Http\Requests;
use Aero\Common\Requests\AeroRequest;
class UpdateAddressRequest extends AeroRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
$address = $this->route('address');
return $address && $this->user()->can('update', $address);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return [
'first_name' => 'required|string|max:255',
'last_name' => 'required|string|max:255',
'company' => 'nullable|string|max:255',
'line_1' => 'required|string|max:255',
'line_2' => 'nullable|string|max:255',
'city' => 'required|string|max:255',
'zone_name' => 'nullable|string|max:255',
'postcode' => 'required|string|max:255',
'country_code' => 'required|string|size:2|exists:countries,code',
'mobile' => 'nullable|string|max:20',
'phone' => 'nullable|string|max:20',
];
}
}
ValidateOrderAddress | FilterSaveRequest |
SeoFormRequest | UpdateSubscriptionPlanRequest |
ValidateCartCustomer | ValidateGuestConversionRequest |
ValidatePaymentMethod | ValidateShippingMethod |
CreateAddressRequest | SearchRequest |
UpdateAccountDetailsRequest | UpdateAccountPasswordRequest |
UpdateAddressRequest | ValidateAccountDetails |
ValidateAddress | ValidateEmail |
ValidateLogin | ValidateRegister |
ValidatePasswordReset | ValidatePasswordUpdate |