34 lines
837 B
PHP
34 lines
837 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Bo\Approaches;
|
|
|
|
use Illuminate\Support\Facades\Gate;
|
|
|
|
class UpdateApproachRequest extends StoreApproachRequest
|
|
{
|
|
/**
|
|
* Prepare the data for validation.
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function prepareForValidation(): void
|
|
{
|
|
/** @var \App\Models\Approach $approachModel */
|
|
$approachModel = $this->route()->parameter('approach');
|
|
$this->merge([
|
|
'type' => intval($approachModel->type->value),
|
|
'published' => $this->boolean('published')
|
|
]);
|
|
$this->mergePicture('picture');
|
|
}
|
|
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return Gate::check('update', $this->route('approach'));
|
|
}
|
|
}
|