FeWo Mail, Booking Services

This commit is contained in:
Kevin Adametz 2020-07-09 12:36:15 +02:00
parent 730832c8e1
commit e6cc042aee
62 changed files with 1766 additions and 284 deletions

View file

@ -76,9 +76,16 @@ use Illuminate\Database\Eloquent\Model;
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\CustomerFewoFile[] $customer_files
* @property-read int|null $customer_files_count
* @property-read \App\Models\CustomerFewoMail|null $customer_mail
* @property \Illuminate\Support\Carbon|null $deleted_at
* @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoMail onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoMail whereDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoMail withTrashed()
* @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoMail withoutTrashed()
*/
class CustomerFewoMail extends Model
{
use \Illuminate\Database\Eloquent\SoftDeletes;
protected $connection = 'mysql_stern';
protected $table = 'customer_fewo_mails';
@ -102,7 +109,8 @@ class CustomerFewoMail extends Model
protected $dates = [
'sent_at',
'scheduled_at',
'delivered_at'
'delivered_at',
'deleted_at'
];
protected $fillable = [
@ -128,6 +136,16 @@ class CustomerFewoMail extends Model
'delivered_at'
];
protected static function boot() {
parent::boot();
static::deleting(function($model) {
foreach ($model->customer_fewo_files as $relation)
{
$relation->delete();
}
});
}
public function customer_fewo_mail()
{
return $this->belongsTo(CustomerFewoMail::class, 'reply_id');