/** * @param \Illuminate\Database\Eloquent\Model $model * @param string $event * @return boolean|null */ protected function generateSlug(Model $model, $event) { // If the "slugging" event returns a value, abort if ($this->fireSluggingEvent($model, $event) !== null) { return; } $wasSlugged = $this->slugService->slug($model); $this->fireSluggedEvent($model, $wasSlugged); }
/** * Test that we can generate a slug statically with different configuration. * * @test */ public function testStaticSlugGeneratorWithConfig() { $config = ['separator' => '.']; $slug = SlugService::createSlug(Post::class, 'slug', 'My Test Post', $config); $this->assertEquals('my.test.post', $slug); }