'integer', 'attachmentable_type' => 'string', 'original_name' => 'string', 'mime_type' => 'string', 'extension' => 'string', 'size' => 'integer', 'hash' => 'string', 'project_id' => 'integer', 'user_id' => 'integer', 'status' => AttachmentStatus::class, ]; /** * It's important to name the relationship the same as the method because otherwise * eager loading of the polymorphic relationship will fail on queued jobs. * * @see https://github.com/laravelio/laravel.io/issues/350 */ public function attachmentAbleRelation(): MorphTo { return $this->morphTo('attachmentAbleRelation', 'attachmentable_type', 'attachmentable_id'); } public function user(): BelongsTo { return $this->belongsTo(User::class, 'user_id'); } public function project(): BelongsTo { return $this->belongsTo(Project::class, 'project_id'); } }