document relationship should specify type of document
This commit is contained in:
parent
3fa2ec8647
commit
c78a5a0a4e
@ -17,7 +17,7 @@ class DocumentHistory extends Model
|
|||||||
|
|
||||||
public function document()
|
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)
|
public function scopeType(Builder $query, string $type)
|
||||||
|
@ -61,7 +61,7 @@ class DocumentItem extends Model
|
|||||||
|
|
||||||
public function document()
|
public function document()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Document\Document');
|
return $this->belongsTo('App\Models\Document\Document')->where('type', $this->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function item()
|
public function item()
|
||||||
|
@ -6,7 +6,6 @@ use App\Abstracts\Model;
|
|||||||
use App\Traits\Currencies;
|
use App\Traits\Currencies;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Znck\Eloquent\Relations\BelongsToThrough as BelongsToThroughRelation;
|
|
||||||
use Znck\Eloquent\Traits\BelongsToThrough;
|
use Znck\Eloquent\Traits\BelongsToThrough;
|
||||||
|
|
||||||
class DocumentItemTax extends Model
|
class DocumentItemTax extends Model
|
||||||
@ -28,7 +27,7 @@ class DocumentItemTax extends Model
|
|||||||
|
|
||||||
public function document()
|
public function document()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Document\Document');
|
return $this->belongsTo('App\Models\Document\Document')->where('type', $this->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function item()
|
public function item()
|
||||||
|
@ -29,7 +29,7 @@ class DocumentTotal extends Model
|
|||||||
|
|
||||||
public function document()
|
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)
|
public function scopeType(Builder $query, string $type)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user