mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-12-24 16:09:14 +01:00
37 lines
694 B
PHP
37 lines
694 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Listeners;
|
||
|
|
||
|
use App\TwoFAccount;
|
||
|
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));
|
||
|
}
|
||
|
}
|