added email subscriptions
This commit is contained in:
@@ -6,6 +6,8 @@ use Illuminate\Support\Str;
|
||||
|
||||
trait Slug
|
||||
{
|
||||
protected $appendsSlug = ['slug'];
|
||||
|
||||
/**
|
||||
* Boot function from Laravel.
|
||||
*
|
||||
@@ -20,6 +22,16 @@ trait Slug
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the trait.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initializeSlug(): void
|
||||
{
|
||||
$this->appends = array_merge($this->appends ?? [], $this->appendsSlug);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value indicating whether the IDs are incrementing.
|
||||
*
|
||||
@@ -47,7 +59,7 @@ trait Slug
|
||||
*/
|
||||
public function getRouteKey()
|
||||
{
|
||||
return $this->slug();
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +80,7 @@ trait Slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function slug()
|
||||
public function getSlugAttribute()
|
||||
{
|
||||
return Str::slug($this->title) . '-' . $this->id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user