2021-11-30 17:34:35 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Listeners;
|
|
|
|
|
2021-12-02 13:15:53 +01:00
|
|
|
use App\Models\TwoFAccount;
|
2021-11-30 17:34:35 +01:00
|
|
|
use App\Events\GroupDeleting;
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
|
|
class DissociateTwofaccountFromGroup
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Create the event listener.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle the event.
|
|
|
|
*
|
|
|
|
* @param GroupDeleting $event
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function handle(GroupDeleting $event)
|
|
|
|
{
|
|
|
|
TwoFAccount::where('group_id', $event->group->id)
|
|
|
|
->update(
|
|
|
|
['group_id' => NULL]
|
|
|
|
);
|
|
|
|
|
|
|
|
Log::info(sprintf('TwoFAccounts dissociated from group #%d', $event->group->id));
|
|
|
|
}
|
|
|
|
}
|