123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace App\Shop\Customers;
- use App\Shop\Addresses\Address;
- use App\Shop\Orders\Order;
- use Illuminate\Database\Eloquent\SoftDeletes;
- use Illuminate\Notifications\Notifiable;
- use Illuminate\Foundation\Auth\User as Authenticatable;
- use Laravel\Cashier\Billable;
- use Nicolaslopezj\Searchable\SearchableTrait;
- class Customer extends Authenticatable
- {
- use Notifiable, SoftDeletes, SearchableTrait, Billable;
-
- protected $fillable = [
- 'name',
- 'email',
- 'password',
- 'status'
- ];
-
- protected $hidden = [
- 'password',
- 'remember_token',
- ];
- protected $dates = ['deleted_at'];
-
- protected $searchable = [
- 'columns' => [
- 'customers.name' => 10,
- 'customers.email' => 5
- ]
- ];
-
- public function addresses()
- {
- return $this->hasMany(Address::class)->whereStatus(true);
- }
-
- public function orders()
- {
- return $this->hasMany(Order::class);
- }
-
- public function searchCustomer($term)
- {
- return self::search($term);
- }
- }
|