belongsTo('App\Note'); } /** * Get the URL for an S3 media file. * * @return string */ public function getUrlAttribute() { if (starts_with($this->path, 'https://')) { return $this->path; } return config('filesystems.disks.s3.url') . '/' . $this->path; } }