public function testWithScope() { $topic = new Topic(); $topic->addBehavior(new SlugBehavior(['scope' => function (Query $query) { $query->where('post_count', '<=', 3); }])); $topic_id = $topic->create(['title' => 'Batman vs Superman']); // Should not increment since other records do not meet scope $this->assertEquals(new Entity(['title' => 'Batman vs Superman', 'slug' => 'batman-vs-superman']), $topic->select('title', 'slug')->where('id', $topic_id)->first()); }