42 lines
932 B
PHP
Executable File
42 lines
932 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Traits\HasCacheModel;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Setting extends Model
|
|
{
|
|
use HasFactory;
|
|
use HasCacheModel;
|
|
|
|
protected $table = 'setting';
|
|
|
|
protected function _getKey()
|
|
{
|
|
$keyLength = strlen(env('APP_KEY'));
|
|
return substr(env('APP_KEY'), round($keyLength / 2), $keyLength);
|
|
}
|
|
|
|
// custom display get{file_name}Attribute()
|
|
public function getFaviconAttribute($value)
|
|
{
|
|
if ($value) {
|
|
return asset("/storage/$value?key=" . $this->_getKey());
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
// custom display get{file_name}Attribute()
|
|
public function getLogoAttribute($value)
|
|
{
|
|
if ($value) {
|
|
return asset("/storage/$value?key=" . $this->_getKey());
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
}
|