*/ protected $fillable = [ 'documentable_type', 'documentable_id', 'name', 'path', 'file_size', 'mime_type', 'type', 'description', 'uploaded_by', ]; /** * The attributes that should be hidden for serialization. * * @var list */ protected $hidden = [ ]; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'name' => 'string', 'path' => 'string', 'file_size' => 'integer', 'mime_type' => 'string', 'type' => 'string', 'description' => 'string', ]; } public function documentable(): MorphTo { return $this->morphTo(); } public function uploadedBy(): BelongsTo { return $this->belongsTo(User::class, 'uploaded_by'); } }