diff --git a/app/GraphQL/Ecosystem/Mutations/Companies/CompanyManagementMutation.php b/app/GraphQL/Ecosystem/Mutations/Companies/CompanyManagementMutation.php index 783abd221..61600a602 100644 --- a/app/GraphQL/Ecosystem/Mutations/Companies/CompanyManagementMutation.php +++ b/app/GraphQL/Ecosystem/Mutations/Companies/CompanyManagementMutation.php @@ -66,7 +66,7 @@ public function deleteCompany(mixed $root, array $request): bool /** * @todo only super admin can do this */ - DeleteCompanyJob::dispatch((int) $request['id'], Auth::user()); + DeleteCompanyJob::dispatch((int) $request['id'], Auth::user(), app(Apps::class)); return true; } diff --git a/src/Kanvas/Companies/Jobs/DeleteCompanyJob.php b/src/Kanvas/Companies/Jobs/DeleteCompanyJob.php index 0e7f46b8d..8500003ee 100644 --- a/src/Kanvas/Companies/Jobs/DeleteCompanyJob.php +++ b/src/Kanvas/Companies/Jobs/DeleteCompanyJob.php @@ -11,6 +11,9 @@ use Illuminate\Queue\SerializesModels; use Kanvas\Companies\Actions\DeleteCompaniesAction; use Kanvas\Users\Models\Users; +use Kanvas\Apps\Models\Apps; +use Illuminate\Support\Facades\Auth; +use Baka\Traits\KanvasJobsTrait; class DeleteCompanyJob implements ShouldQueue { @@ -18,16 +21,21 @@ class DeleteCompanyJob implements ShouldQueue use InteractsWithQueue; use Queueable; use SerializesModels; + use KanvasJobsTrait; public function __construct( public int $companiesId, - public Users $user + public Users $user, + public Apps $app ) { } public function handle(): void { - $companyDelete = new DeleteCompaniesAction($this->user); + Auth::loginUsingId($this->user->getId()); + $this->overwriteAppService($this->app); + + $companyDelete = new DeleteCompaniesAction($this->user, $this->app); $companyDelete->execute($this->companiesId); } }