changed company id set in forms

This commit is contained in:
denisdulici 2020-01-03 23:54:21 +03:00
parent f6e0c4dfc2
commit 906b7045fa

View File

@ -8,22 +8,15 @@ use Illuminate\Support\Arr;
abstract class FormRequest extends BaseFormRequest
{
/**
* Set the company id to the request.
* Prepare the data for validation.
*
* @return \Illuminate\Contracts\Validation\Validator
* @return void
*/
protected function getValidatorInstance()
protected function prepareForValidation()
{
// Get request data
$data = $this->all();
// Add active company id
$data['company_id'] = session('company_id');
// Reset the request data
$this->getInputSource()->replace($data);
return parent::getValidatorInstance();
$this->merge([
'company_id' => session('company_id'),
]);
}
/**