Server : Apache System : Linux 145.162.205.92.host.secureserver.net 5.14.0-611.45.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Apr 1 05:56:53 EDT 2026 x86_64 User : tradze ( 1001) PHP Version : 8.1.34 Disable Function : NONE Directory : /home/tradze/.trash/app_old/Modules/Blog_old/Models/ |
<?php
namespace App\Modules\Blog\Models;
use Carbon\Carbon;
use Cviebrock\EloquentSluggable\Sluggable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class BlogCategory extends Model
{
use SoftDeletes;
use Sluggable;
/**
* The database table used by the model.
*
* @var string
*/
protected $table="blog_categories";
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['order','title','slug','body','meta_title','meta_keywords','meta_description'];
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = ['deleted_at'];
/**
* Get the blog posts associated with the blog category.
*/
public function posts()
{
return $this->hasMany('App\Modules\Blog\Models\BlogPost','category_id');
}
/**
* Set sluggable attribute
* @return array
*/
public function sluggable()
{
return [
'slug' => [
'source' => 'slug'
]
];
}
/**
* The page url
*
* @return mixed null|string
*/
public function getUrlAttribute()
{
return route('blog.category', ['slug' => $this->slug]);
}
}