45 lines
966 B
PHP
45 lines
966 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Bo\DeliveryMode;
|
|
|
|
use App\Models\DeliveryMode;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdateDeliveryModeRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function authorize()
|
|
{
|
|
return $this->authorize('update', DeliveryMode::class);
|
|
}
|
|
|
|
/**
|
|
* Prepare the data for validation.
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function prepareForValidation()
|
|
{
|
|
$this->merge([
|
|
'is_available' => $this->is_available ? true : false,
|
|
'is_free' => $this->is_free ? true : false
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
'is_available' => 'required|boolean',
|
|
'is_free' => 'required|boolean'
|
|
];
|
|
}
|
|
}
|