2018-07-20 15:07:16 +00:00
|
|
|
<?php
|
2018-07-24 14:33:49 +00:00
|
|
|
|
2018-07-20 15:07:16 +00:00
|
|
|
namespace Webkul\Customer\Models;
|
|
|
|
|
|
2018-07-24 14:33:49 +00:00
|
|
|
use Illuminate\Notifications\Notifiable;
|
|
|
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
2018-09-08 08:41:36 +00:00
|
|
|
use Webkul\Customer\Models\CustomersGroups;
|
2018-07-24 14:33:49 +00:00
|
|
|
|
|
|
|
|
// use Webkul\User\Notifications\AdminResetPassword;
|
|
|
|
|
|
|
|
|
|
// use Webkul\User\Notifications\AdminResetPassword;
|
2018-07-20 15:07:16 +00:00
|
|
|
|
2018-07-24 14:33:49 +00:00
|
|
|
|
|
|
|
|
class Customer extends Authenticatable
|
2018-07-20 15:07:16 +00:00
|
|
|
{
|
2018-07-24 14:33:49 +00:00
|
|
|
use Notifiable;
|
|
|
|
|
|
2018-07-20 15:07:16 +00:00
|
|
|
protected $table = 'customers';
|
2018-09-08 08:41:36 +00:00
|
|
|
|
2018-09-08 08:52:46 +00:00
|
|
|
protected $fillable = ['first_name', '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-07-27 13:37:56 +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()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(CustomersGroups::class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-07-20 15:07:16 +00:00
|
|
|
}
|