sarga/packages/Webkul/Customer/src/Models/Customer.php

42 lines
1.0 KiB
PHP
Raw Normal View History

<?php
namespace Webkul\Customer\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
2018-10-23 11:51:04 +00:00
use Webkul\Customer\Models\CustomerGroup;
2018-10-15 08:22:27 +00:00
use Webkul\Sales\Models\Order;
// use Webkul\User\Notifications\AdminResetPassword;
// use Webkul\User\Notifications\AdminResetPassword;
class Customer extends Authenticatable
{
use Notifiable;
protected $table = 'customers';
2018-09-08 08:41:36 +00:00
2018-10-23 11:49:13 +00:00
protected $fillable = ['first_name', 'channel_id', 'last_name', 'gender', 'date_of_birth', 'phone', 'email', 'password', 'customer_group_id', 'subscribed_to_news_letter'];
2018-09-08 08:41:36 +00:00
2018-10-23 11:45:44 +00:00
protected $hidden = ['password', 'remember_token'];
2018-08-30 13:22:15 +00:00
2018-09-08 08:41:36 +00:00
protected $with = ['customerGroup'];
/**
* Get the customer full name.
*/
2018-08-30 13:22:15 +00:00
public function getNameAttribute() {
return ucfirst($this->first_name) . ' ' . ucfirst($this->last_name);
}
2018-09-08 08:41:36 +00:00
/**
* Get the customer group that owns the customer.
*/
public function customerGroup()
{
2018-10-23 11:51:04 +00:00
return $this->belongsTo(CustomerGroup::class);
2018-09-08 08:41:36 +00:00
}
}