ldc-crm/app/Http/Requests/Bo/UpdateChangeOrderRequest.php

43 lines
819 B
PHP
Raw Permalink Normal View History

2023-06-15 12:28:35 +02:00
<?php
2023-10-06 15:00:42 +02:00
namespace App\Http\Requests\Bo;
2023-06-15 12:28:35 +02:00
use Illuminate\Foundation\Http\FormRequest;
2023-10-06 15:00:42 +02:00
class UpdateChangeOrderRequest extends FormRequest
2023-06-15 12:28:35 +02:00
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
2023-10-06 15:00:42 +02:00
return auth('backend')->check();
2023-06-15 12:28:35 +02:00
}
/**
2023-10-06 15:00:42 +02:00
* Prepare the data for validation.
2023-06-15 12:28:35 +02:00
*
2023-10-06 15:00:42 +02:00
* @return void
2023-06-15 12:28:35 +02:00
*/
2023-10-06 15:00:42 +02:00
protected function prepareForValidation(): void
2023-06-15 12:28:35 +02:00
{
2023-10-06 15:00:42 +02:00
$this->merge([
'direction' => $this->direction === 'up' ? true : false
]);
2023-06-15 12:28:35 +02:00
}
/**
2023-10-06 15:00:42 +02:00
* Get the validation rules that apply to the request.
2023-06-15 12:28:35 +02:00
*
* @return array
*/
2023-10-06 15:00:42 +02:00
public function rules(): array
2023-06-15 12:28:35 +02:00
{
return [
2023-10-06 15:00:42 +02:00
'direction' => 'required|boolean',
2023-06-15 12:28:35 +02:00
];
}
}