Current File : //home/tradevaly/prioyshi.com/project/app/Models/Category.php |
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Category extends Model
{
protected $fillable = ['name','slug','photo','is_featured','image','meta_title','meta_description'];
public $timestamps = false;
public function subs()
{
return $this->hasMany('App\Models\Subcategory')->where('status','=',1);
}
public function products()
{
return $this->hasMany('App\Models\Product');
}
public function setSlugAttribute($value)
{
$this->attributes['slug'] = str_replace(' ', '-', $value);
}
public function attributes() {
return $this->morphMany('App\Models\Attribute', 'attributable');
}
}