37 lines
897 B
PHP
37 lines
897 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Api\V2;
|
|
|
|
use ArondeParon\RequestSanitizer\Sanitizers\Lowercase;
|
|
use ArondeParon\RequestSanitizer\Sanitizers\RemoveNonNumeric;
|
|
use ArondeParon\RequestSanitizer\Sanitizers\Trim;
|
|
use ArondeParon\RequestSanitizer\Traits\SanitizesInputs;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
abstract class BaseApiRequest extends FormRequest
|
|
{
|
|
use SanitizesInputs;
|
|
|
|
protected $sanitizers = [
|
|
'password' => Trim::class,
|
|
'email' => [Lowercase::class, Trim::class],
|
|
'postcode' => RemoveNonNumeric::class
|
|
];
|
|
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function authorize()
|
|
{
|
|
return auth()->check();
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
abstract public function rules(): array;
|
|
}
|