akaunting/app/Abstracts/Http/FormRequest.php

36 lines
731 B
PHP
Raw Normal View History

2019-11-16 10:21:14 +03:00
<?php
namespace App\Abstracts\Http;
use Illuminate\Foundation\Http\FormRequest as BaseFormRequest;
use Illuminate\Support\Arr;
abstract class FormRequest extends BaseFormRequest
{
/**
2020-01-03 23:54:21 +03:00
* Prepare the data for validation.
2019-11-16 10:21:14 +03:00
*
2020-01-03 23:54:21 +03:00
* @return void
2019-11-16 10:21:14 +03:00
*/
2020-01-03 23:54:21 +03:00
protected function prepareForValidation()
2019-11-16 10:21:14 +03:00
{
2020-01-03 23:54:21 +03:00
$this->merge([
'company_id' => session('company_id'),
]);
2019-11-16 10:21:14 +03:00
}
/**
* Determine if the given offset exists.
*
* @param string $offset
* @return bool
*/
public function offsetExists($offset)
{
return Arr::has(
$this->route() ? $this->all() + $this->route()->parameters() : $this->all(),
$offset
);
}
}