46 lines
1,008 B
PHP
46 lines
1,008 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Bo\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()
|
|
{
|
|
/** @var \App\Models\User|null */
|
|
$user = \auth('backend')->user();
|
|
return $user and $user->can('update', $this->delivery_mode);
|
|
}
|
|
|
|
/**
|
|
* Prepare the data for validation.
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function prepareForValidation()
|
|
{
|
|
$this->merge([
|
|
'status' => $this->status ? true : false,
|
|
'is_free' => $this->is_free ? true : false
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
'status' => 'required|boolean',
|
|
'is_free' => 'required|boolean'
|
|
];
|
|
}
|
|
}
|