Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch so that slugging occurs after the model is saved, which allows…
… using the primary key as a source.
- Loading branch information
Showing
5 changed files
with
67 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php namespace Cviebrock\EloquentSluggable\Tests\Models; | ||
|
||
/** | ||
* Class PostWithIdSource | ||
* | ||
* A test model that uses the model's ID in the slug source. | ||
* | ||
* @package Cviebrock\EloquentSluggable\Tests\Models | ||
*/ | ||
class PostWithIdSource extends Post | ||
{ | ||
|
||
/** | ||
* Return the sluggable configuration array for this model. | ||
* | ||
* @return array | ||
*/ | ||
public function sluggable(): array | ||
{ | ||
return [ | ||
'slug' => [ | ||
'source' => ['title','id'] | ||
] | ||
]; | ||
} | ||
} |