for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Xetaravel\Models;
use Eloquence\Behaviours\Sluggable;
class Category extends Model
{
use Sluggable;
/**
* The "booting" method of the model.
*
* @return void
*/
protected static function boot()
parent::boot();
// Generated the slug before updating.
static::updating(function ($model) {
$model->generateSlug();
});
}
* Return the field to slug.
* @return string
public function slugStrategy(): string
return 'title';
* Get the articles for the category.
* @return \Illuminate\Database\Eloquent\Relations\HasMany
public function articles()
return $this->hasMany(Article::class);