removed session from jobs

This commit is contained in:
Denis Duliçi
2020-12-25 12:08:15 +03:00
parent 5fa882b4e3
commit 7c126169c8
17 changed files with 51 additions and 39 deletions

View File

@ -16,16 +16,19 @@ class UpdateCompany extends Job
protected $request;
protected $active_company_id;
/**
* Create a new job instance.
*
* @param $company
* @param $request
*/
public function __construct($company, $request)
public function __construct($company, $request, $active_company_id)
{
$this->company = $company;
$this->request = $this->getRequestInstance($request);
$this->active_company_id = $active_company_id;
}
/**
@ -94,7 +97,7 @@ class UpdateCompany extends Job
public function authorize()
{
// Can't disable active company
if (($this->request->get('enabled', 1) == 0) && ($this->company->id == session('company_id'))) {
if (($this->request->get('enabled', 1) == 0) && ($this->company->id == $this->active_company_id)) {
$message = trans('companies.error.disable_active');
throw new \Exception($message);