<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Auth;

class BankDetails extends Model
{
    use HasFactory;
    protected $guarded = [];

    // public function activity(){
    //     return $this->hasMany('App\Models\Activity','module_id')->where('module',"Accounts");
    // }

    protected static function boot()
    {
        parent::boot();

        BankDetails::creating(function($model) {
            $user = Auth::user();
            if($user!=null){
                // $model->enteredbyid = $user->id;
                $model->organisation_id = $user->active_organisation;
            }
        });
    }
}
