1
0
mirror of https://github.com/freescout-helpdesk/freescout.git synced 2024-11-25 11:52:29 +01:00
freescout/app/Observers/MailboxObserver.php

41 lines
813 B
PHP
Raw Normal View History

2018-07-14 03:23:37 +02:00
<?php
namespace App\Observers;
2018-07-24 08:34:28 +02:00
use App\Mailbox;
2018-07-14 03:23:37 +02:00
class MailboxObserver
{
/**
* Listen to the Mailbox created event.
*
2018-07-24 08:34:28 +02:00
* @param \App\Mailbox $mailbox
*
2018-07-14 03:23:37 +02:00
* @return void
*/
public function created(Mailbox $mailbox)
{
2018-07-25 19:25:00 +02:00
// Create folders
2018-08-10 16:28:35 +02:00
$mailbox->createPublicFolders();
$mailbox->syncPersonalFolders();
2018-07-14 03:23:37 +02:00
$mailbox->createAdminPersonalFolders();
}
/**
* Delete the following on mailbox delete:
* - folders
* - conversations
2018-07-24 08:34:28 +02:00
* - user permissions.
*
* @param Mailbox $mailbox
*
* @return [type] [description]
2018-07-14 03:23:37 +02:00
*/
public function deleting(Mailbox $mailbox)
{
$mailbox->users()->delete();
$mailbox->conversations()->delete();
$mailbox->folders()->delete();
}
2018-07-24 08:34:28 +02:00
}