Save uploaded files to S3 and generate a URL

This commit is contained in:
Jonny Barnes 2017-03-10 09:58:35 +00:00
parent bd57ce56d4
commit 2c5c6e7753
4 changed files with 23 additions and 14 deletions

View file

@ -13,13 +13,6 @@ class Media extends Model
*/
protected $table = 'media_endpoint';
/**
* Our primaru key is a UUID value, therefore not incrementing.
*
* @var boolean
*/
protected $incrementing = false;
/**
* Get the note that owns this media.
*/
@ -27,4 +20,14 @@ class Media extends Model
{
return $this->belongsTo('App\Note');
}
/**
* Get the URL for an S3 media file.
*
* @return string
*/
public function getUrlAttribute()
{
return config('filesystems.s3.url') . '/' . $this->path;
}
}