Fix the error shown when trying to create a Customer with no linked Mailbox
This commit is contained in:
parent
d61183c0a8
commit
732695922a
1 changed files with 7 additions and 1 deletions
|
@ -70,7 +70,13 @@ class MMFRestrictedCustomersServiceProvider extends ServiceProvider {
|
|||
if ( array_key_exists('mailbox_id', $data) ) {
|
||||
$customer->mailbox_id = $data['mailbox_id'];
|
||||
} else {
|
||||
$customer = Customer::find($customer->id);
|
||||
$customer_id = $customer->id;
|
||||
if ( $customer_id == null ) {
|
||||
Log::error('The creation of a Customer with no link to a Mailbox is not allowed, and has been aborted.');
|
||||
// TODO: Error out more gracefully.
|
||||
abort(500, 'The creation of a Customer with no link to a Mailbox is not allowed, and has been aborted.');
|
||||
}
|
||||
$customer = Customer::find($customer_id);
|
||||
if ( $customer == null ) {
|
||||
Log::error('Trying to use a Customer in another Mailbox than the one it is linked to is not allowed, and has been aborted.');
|
||||
// TODO: Error out more gracefully.
|
||||
|
|
Loading…
Reference in a new issue