document relationship should specify type of document

This commit is contained in:
Sevan Nerse
2020-12-28 11:36:09 +03:00
parent 3fa2ec8647
commit c78a5a0a4e
4 changed files with 5 additions and 6 deletions

View File

@ -17,7 +17,7 @@ class DocumentHistory extends Model
public function document()
{
return $this->belongsTo('App\Models\Document\Document');
return $this->belongsTo('App\Models\Document\Document')->where('type', $this->type);
}
public function scopeType(Builder $query, string $type)