for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Xetaravel\Models;
use Xetaravel\Models\Presenters\CategoryPresenter;
class Category extends Model
{
use CategoryPresenter;
Xetaravel\Models\Presenters\CategoryPresenter
$slug
Xetaravel\Models\Category
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'title',
'slug',
'description'
];
* The accessors to append to the model's array form.
protected $appends = [
'category_url'
* 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);