akaunting/app/Abstracts/Http/FormRequest.php
2022-06-01 10:15:55 +03:00

46 lines
902 B
PHP

<?php
namespace App\Abstracts\Http;
use Illuminate\Foundation\Http\FormRequest as BaseFormRequest;
use Illuminate\Support\Arr;
abstract class FormRequest extends BaseFormRequest
{
/**
* Prepare the data for validation.
*
* @return void
*/
protected function prepareForValidation()
{
$this->merge([
'company_id' => company_id(),
]);
}
/**
* Determine if the given offset exists.
*
* @param string $offset
* @return bool
*/
public function offsetExists($offset): bool
{
return Arr::has(
$this->route() ? $this->all() + $this->route()->parameters() : $this->all(),
$offset
);
}
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
}