<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Str; class News extends Model { use HasFactory; protected $table = 'news'; protected static function boot() { parent::boot(); static::creating(function ($question) { $question->link = Str::slug($question->title); }); } }