Skip to content

Commit

Permalink
user destroying flow updated
Browse files Browse the repository at this point in the history
  • Loading branch information
sevannerse committed Jun 29, 2022
1 parent 127d85d commit c846aa0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 34 deletions.
2 changes: 2 additions & 0 deletions app/Jobs/Auth/DeleteUser.php
Expand Up @@ -16,6 +16,8 @@ public function handle(): bool
event(new UserDeleting($this->model));

\DB::transaction(function () {
$this->deleteRelationships($this->model, ['invitation']);

$this->model->delete();

$this->model->flushCache();
Expand Down
28 changes: 0 additions & 28 deletions app/Listeners/Auth/DeleteUserInvitation.php

This file was deleted.

1 change: 1 addition & 0 deletions app/Listeners/Update/V30/Version304.php
Expand Up @@ -58,6 +58,7 @@ public function deleteOldFiles()
$files = [
'app/Events/Auth/InvitationCreated.php',
'app/Listeners/Auth/SendUserInvitation.php',
'app/Listeners/Auth/DeleteUserInvitation.php',
];

foreach ($files as $file) {
Expand Down
5 changes: 5 additions & 0 deletions app/Models/Auth/User.php
Expand Up @@ -89,6 +89,11 @@ public function dashboards()
return $this->belongsToMany('App\Models\Common\Dashboard', 'App\Models\Auth\UserDashboard');
}

public function invitation()
{
return $this->hasOne('App\Models\Auth\UserInvitation', 'user_id', 'id');
}

/**
* Always capitalize the name when we retrieve it
*/
Expand Down
6 changes: 0 additions & 6 deletions app/Providers/Event.php
Expand Up @@ -32,12 +32,6 @@ class Event extends Provider
'App\Events\Auth\LandingPageShowing' => [
'App\Listeners\Auth\AddLandingPages',
],
'App\Events\Auth\InvitationCreated' => [
'App\Listeners\Auth\SendUserInvitation',
],
'App\Events\Auth\UserDeleted' => [
'App\Listeners\Auth\DeleteUserInvitation',
],
'App\Events\Document\DocumentCreated' => [
'App\Listeners\Document\CreateDocumentCreatedHistory',
'App\Listeners\Document\IncreaseNextDocumentNumber',
Expand Down

0 comments on commit c846aa0

Please sign in to comment.