37 lines
732 B
PHP
37 lines
732 B
PHP
<?php namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class SettingsGlobal extends Model
|
|
{
|
|
protected $table = 'settings_global';
|
|
|
|
protected $fillable = [
|
|
'business_name',
|
|
'logo_path',
|
|
'contact_info',
|
|
'invoice',
|
|
];
|
|
|
|
protected $casts = [
|
|
'contact_info' => 'array',
|
|
'invoice' => 'array',
|
|
];
|
|
|
|
//HELPERS
|
|
public static function get(): ?self
|
|
{
|
|
return self::first();
|
|
}
|
|
|
|
public function getContactValue(string $key, $default = null)
|
|
{
|
|
return $this->contact_info[$key] ?? $default;
|
|
}
|
|
|
|
public function getInvoiceValue(string $key, $default = null)
|
|
{
|
|
return $this->invoice[$key] ?? $default;
|
|
}
|
|
}
|