You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
722 B
PHTML

<?php
namespace App\Models;
1 year ago
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Concerns\HasUlids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Setting extends Model
{
use HasFactory, SoftDeletes, HasUlids;
protected $fillable = [
'key',
'value',
'type',
];
1 year ago
protected $appends = [
'url',
];
protected function url(): Attribute
{
return Attribute::make(get: function () {
if ($this->type == 'image') {
return asset($this->value);
}
return '';
});
}
}