mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-04-14 20:48:37 +02:00
Fix MySQL foreign key constraint error on Group delete
This commit is contained in:
parent
b79570bcd9
commit
69c3f08f7b
@ -41,6 +41,24 @@ class Group extends Model
|
|||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override The "booting" method of the model
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected static function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
|
static::deleting(function ($model) {
|
||||||
|
TwoFAccount::where('group_id', $model->id)
|
||||||
|
->update(
|
||||||
|
['group_id' => NULL]
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the TwoFAccounts of the group.
|
* Get the TwoFAccounts of the group.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user