I am currently trying to setup a simple web-app, using Laravel Mailbox. I can see that I can define a custom model to use in the config file:
/*
* The model class to use when converting an incoming email to a message.
* It must extend the default model class
*/
'model' => \BeyondCode\Mailbox\InboundEmail::class,
Above is the default model it uses.
I have changed it to:
/*
* The model class to use when converting an incoming email to a message.
* It must extend the default model class
*/
'model' => Email::class,
Now, I wish to use my own model, because I want to store the e-mails on another table. For this, I have created my own model, and trying to extend the original one from the package, but overwrite the $table
for example.
App/Email.php:
namespace App;
use BeyondCode\Mailbox\InboundEmail as InboundEmail;
class Email extends InboundEmail
{
protected static function boot()
{
parent::boot();
}
protected $table = 'emails';
}
However, above gives me below error:
Undefined property: App\Email::$message {"exception":"[object] (ErrorException(code: 0): Undefined property: App\\Email::$message at /Users/Username/Sites/playground/vendor/beyondcode/laravel-mailbox/src/InboundEmail.php:130)
I suspect it is because I don't have the original methods in my own model App/Email.php
, that are present in the package model.
Isn't there a way that I can use my own model, by extending the package model, but without copying the content of the package model into my own?