diff --git a/tests/Etc/Comment.php b/tests/Etc/Comment.php index 691e82e0..bdc95ffe 100644 --- a/tests/Etc/Comment.php +++ b/tests/Etc/Comment.php @@ -5,10 +5,15 @@ namespace Stancl\Tenancy\Tests\Etc; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; +/** + * This model is not intended to be used with the single-database tenancy approach. + */ class Comment extends Model { protected $guarded = []; + protected $table = 'comments'; + public $timestamps = false; public function post(): BelongsTo diff --git a/tests/Etc/Post.php b/tests/Etc/Post.php index d73ed731..365e216d 100644 --- a/tests/Etc/Post.php +++ b/tests/Etc/Post.php @@ -24,6 +24,7 @@ class Post extends Model public function scoped_comments(): HasMany { - return $this->hasMany(Comment::class); + // ScopedComment = Comment model with the BelongsToPrimaryModel trait + return $this->hasMany(ScopedComment::class); } } diff --git a/tests/Etc/ScopedComment.php b/tests/Etc/ScopedComment.php index 90b4f4dd..6eca2d2a 100644 --- a/tests/Etc/ScopedComment.php +++ b/tests/Etc/ScopedComment.php @@ -11,8 +11,6 @@ class ScopedComment extends Comment { use BelongsToPrimaryModel; - protected $table = 'comments'; - public function getRelationshipToPrimaryModel(): string { return 'post';