*/ protected $fillable = [ 'name', 'email', 'role', 'dealer_id', 'password', 'role_id' ]; /** * The attributes that should be hidden for serialization. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', ]; /** * Get all of the transactions for the User * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function transactions() { return $this->hasMany(Transaction::class, 'user_id', 'id'); } /** * Get all of the sa_transactions for the User * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function sa_transactions() { return $this->hasMany(Transaction::class, 'user_sa_id', 'id'); } /** * Get the dealer associated with the User * * @return \Illuminate\Database\Eloquent\Relations\HasOne */ public function dealer() { return $this->hasOne(Dealer::class, 'id', 'dealer_id'); } }