add private option to attachments

This commit is contained in:
2023-05-11 13:37:40 +10:00
parent d0ea0ae4d3
commit fc853bd5f1
2 changed files with 49 additions and 1 deletions

View File

@@ -4,6 +4,8 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphTo;
class Attachment extends Model
{
@@ -16,11 +18,23 @@ class Attachment extends Model
*/
protected $fillable = [
'media_id',
'private',
];
/**
* The default attributes.
*
* @var string[]
*/
protected $attributes = [
'private' => 'false',
];
/**
* Get attachments attachable
*
* @return MorphTo
*/
public function attachable()
{
@@ -29,9 +43,11 @@ class Attachment extends Model
/**
* Get the media for this attachment.
*
* @return BelongsTo
*/
public function media()
{
return $this->belongsTo(Media::class);
}
}
}