<?php

namespace App\Models;

use App\Constants\Status;
use App\Traits\ApiQuery;
use App\Traits\GlobalStatus;
use Illuminate\Database\Eloquent\Model;

class Company extends Model
{
    use ApiQuery, GlobalStatus;

    protected $casts  = ['mail_config' => 'object'];
    protected $hidden = ['mail_config'];

    public function createdBy()
    {
        return $this->belongsTo(Admin::class, 'admin_id');
    }

    protected static function boot()
    {
        parent::boot();
        static::saved(function(){
            \Cache::forget('CompanyData');
        });
    }

}
