Merge branch 'ai-forms'
This commit is contained in:
@@ -4,11 +4,13 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\Sluggable\HasSlug;
|
||||
use Spatie\Sluggable\SlugOptions;
|
||||
use Stevebauman\Purify\Facades\Purify;
|
||||
|
||||
class Template extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasFactory, HasSlug;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
@@ -29,4 +31,15 @@ class Template extends Model
|
||||
// Strip out unwanted html
|
||||
$this->attributes['description'] = Purify::clean($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Config/options
|
||||
*/
|
||||
public function getSlugOptions(): SlugOptions
|
||||
{
|
||||
return SlugOptions::create()
|
||||
->doNotGenerateSlugsOnUpdate()
|
||||
->generateSlugsFrom('name')
|
||||
->saveSlugsTo('slug');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user