added email subscriptions

This commit is contained in:
2024-09-27 22:16:29 +10:00
parent db018e9120
commit b10b6b712e
10 changed files with 203 additions and 5 deletions

View File

@@ -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;
}