Add company create and update events

This commit is contained in:
Burak Çakırel
2020-09-13 21:57:10 +03:00
parent c72b5194dd
commit 0dfb759ab0
6 changed files with 108 additions and 0 deletions

View File

@ -3,6 +3,8 @@
namespace App\Jobs\Common;
use App\Abstracts\Job;
use App\Events\Common\CompanyUpdated;
use App\Events\Common\CompanyUpdating;
use App\Models\Common\Company;
use App\Traits\Users;
@ -35,6 +37,8 @@ class UpdateCompany extends Job
{
$this->authorize();
event(new CompanyUpdating($this->company, $this->request));
\DB::transaction(function () {
$this->company->update($this->request->all());
@ -77,6 +81,8 @@ class UpdateCompany extends Job
setting()->forgetAll();
});
event(new CompanyUpdated($this->company, $this->request));
return $this->company;
}