mirror of
https://github.com/freescout-helpdesk/freescout.git
synced 2024-11-25 11:52:29 +01:00
41 lines
813 B
PHP
41 lines
813 B
PHP
<?php
|
|
|
|
namespace App\Observers;
|
|
|
|
use App\Mailbox;
|
|
|
|
class MailboxObserver
|
|
{
|
|
/**
|
|
* Listen to the Mailbox created event.
|
|
*
|
|
* @param \App\Mailbox $mailbox
|
|
*
|
|
* @return void
|
|
*/
|
|
public function created(Mailbox $mailbox)
|
|
{
|
|
// Create folders
|
|
$mailbox->createPublicFolders();
|
|
$mailbox->syncPersonalFolders();
|
|
$mailbox->createAdminPersonalFolders();
|
|
}
|
|
|
|
/**
|
|
* Delete the following on mailbox delete:
|
|
* - folders
|
|
* - conversations
|
|
* - user permissions.
|
|
*
|
|
* @param Mailbox $mailbox
|
|
*
|
|
* @return [type] [description]
|
|
*/
|
|
public function deleting(Mailbox $mailbox)
|
|
{
|
|
$mailbox->users()->delete();
|
|
$mailbox->conversations()->delete();
|
|
$mailbox->folders()->delete();
|
|
}
|
|
}
|