'datetime']; public function delivery_addresses() { return $this->addresses()->byDelivery(); } public function invoice_addresses() { return $this->addresses()->byInvoicing(); } public function addresses() { return $this->hasMany(CustomerAddress::class); } public function customer_deliveries() { return $this->hasMany(CustomerDelivery::class); } public function customer_sale_channels() { return $this->hasMany(CustomerSaleChannel::class); } public function deliveries() { return $this->belongsToMany(Delivery::class, CustomerDelivery::class); } public function sale_channels() { return $this->belongsToMany(SaleChannel::class, CustomerSaleChannel::class)->wherePivotNull('deleted_at'); } public function invoices() { return $this->hasMany(Invoice::class); } public function orders() { return $this->hasMany(Order::class); } public function scopeBySaleChannel($query, $saleChannelId) { return $query->whereHas('sale_channels', function ($query) use ($saleChannelId) { return $query->byId($saleChannelId); }); } public function sendEmailVerificationNotification() { if (config('boilerplate.auth.verify_email')) { $this->notify(new VerifyEmail()); } } public function sendPasswordResetNotification($token) { $this->notify(new ResetPassword($token)); } public function getNameAttribute() { return $this->getAttribute('first_name').' '.$this->getAttribute('last_name'); } }