Viewing file: User.php (1.54 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Laravel\Sanctum\HasApiTokens; class User extends Authenticatable { use Notifiable,SoftDeletes,HasApiTokens;
/** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'name', 'email', 'password', ];
protected $guard_name = ['customer']; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'password', 'remember_token', ];
/** * The attributes that should be cast to native types. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', ];
public function customers(){ return $this->hasMany(Customer::class,'admin_id'); }
public function plans(){ return $this->hasMany(Plan::class,'admin_id'); } public function plan_requests(){ return $this->hasMany(BillingRequest::class,'admin_id'); } public function active_plans(){ return $this->plans()->where('status','active'); } public function settings(){ return $this->hasMany(Settings::class,'admin_id'); } public function pages(){ return $this->hasMany(Page::class,'admin_id'); } public function tickets(){ return $this->hasMany(Ticket::class, 'admin_id', 'id'); } }
|