<?php

namespace App\Models;

use App\User;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;

class CashAdvance extends Model
{
    use SoftDeletes;

    protected $fillable = ['ca_date', 'agent_id', 'amount', 'remarks', 'user_id', 'status'];

    protected $table = 'cash_advances';

    public static function boot()
    {
        //parent::boot();
        //Developer::observe(new \App\Observers\UserActionsObserver);
    }

    /*public function getFullnameAttribute() {
        return "{$this->firstname} {$this->lastname}";
    }*/

    public function agent() {
        return $this->belongsTo(Agent::class, 'agent_id');
    }

    public function user() {
        return $this->belongsTo(User::class, 'user_id');
    }

}
