| 1234567891011121314151617181920212223242526272829 |
- <?php
-
- namespace App\Models;
-
- use Illuminate\Database\Eloquent\Casts\Attribute;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Support\Facades\Storage;
- use Spatie\Translatable\HasTranslations;
-
- class Banner extends Model
- {
- use HasTranslations;
-
- //
- protected $guarded = ["id"];
- public $translatable = ['title', 'content', 'img_alt'];
-
- public $appends = [
- "img_url_link"
- ];
-
- protected function imgUrlLink(): Attribute
- {
- return Attribute::make(
- get: fn ($value) => is_null($this->ing_url) ? null :Storage::url($this->ing_url),
- );
- }
- }
|