mirror of
https://github.com/freescout-helpdesk/freescout.git
synced 2024-11-25 11:52:29 +01:00
36 lines
704 B
PHP
36 lines
704 B
PHP
<?php
|
|
|
|
namespace App\Observers;
|
|
|
|
use App\Mailbox;
|
|
use App\Subscription;
|
|
use App\User;
|
|
|
|
class UserObserver
|
|
{
|
|
/**
|
|
* Thread created.
|
|
*
|
|
* @param User $user
|
|
*/
|
|
public function created(User $user)
|
|
{
|
|
// We can not create folders for regular users here, as user is not connected to mailboxes yet
|
|
// But we can create admin personal folders
|
|
Mailbox::createAdminPersonalFoldersAllMailboxes();
|
|
|
|
// Add default subscriptions
|
|
Subscription::addDefaultSubscriptions($user->id);
|
|
}
|
|
|
|
/**
|
|
* On user delete.
|
|
*
|
|
* @param User $user
|
|
*/
|
|
public function deleting(User $user)
|
|
{
|
|
$user->folders()->delete();
|
|
}
|
|
}
|