mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 17:04:04 +00:00
Rename parent model -> getRelationshipToPrimaryModel
This commit is contained in:
parent
c05262f534
commit
f4898bec2b
3 changed files with 3 additions and 3 deletions
|
|
@ -6,7 +6,7 @@ use Stancl\Tenancy\Database\ParentModelScope;
|
||||||
|
|
||||||
trait BelongsToPrimaryModel
|
trait BelongsToPrimaryModel
|
||||||
{
|
{
|
||||||
abstract public function getParentRelationshipName(): string;
|
abstract public function getRelationshipToPrimaryModel(): string;
|
||||||
|
|
||||||
public static function bootBelongsToPrimaryModel()
|
public static function bootBelongsToPrimaryModel()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class ParentModelScope implements Scope
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$builder->whereHas($builder->getModel()->getParentRelationshipName());
|
$builder->whereHas($builder->getModel()->getRelationshipToPrimaryModel());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function extend(Builder $builder)
|
public function extend(Builder $builder)
|
||||||
|
|
|
||||||
|
|
@ -310,7 +310,7 @@ class ScopedComment extends Comment
|
||||||
|
|
||||||
protected $table = 'comments';
|
protected $table = 'comments';
|
||||||
|
|
||||||
public function getParentRelationshipName(): string
|
public function getRelationshipToPrimaryModel(): string
|
||||||
{
|
{
|
||||||
return 'post';
|
return 'post';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue