// +---------------------------------------------------------------------- namespace App\Models\System; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Support\Facades\Storage; use App\Models\Auth\Admin; class Tasks extends \App\Models\BaseModel { protected $table = 'system_tasks'; protected $fillable = []; protected $hidden = ['deleted_at']; protected $append = ['url']; public function url(): Attribute{ return Attribute::make( get: fn (mixed $value, array $data) => Storage::disk('public')->url($data['file']), ); } public function user() { return $this->belongsTo(Admin::class, 'user_id', 'uid'); } }