39 lines
906 B
PHP
39 lines
906 B
PHP
<?php
|
|
|
|
namespace App\Models\Shop;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
use Spatie\MediaLibrary\HasMedia;
|
|
use Spatie\MediaLibrary\InteractsWithMedia;
|
|
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
|
|
|
// use Rinvex\Categories\Traits\Categorizable;
|
|
use Rinvex\Tags\Traits\Taggable;
|
|
// use Conner\Tagging\Taggable;
|
|
use Fico7489\Laravel\EloquentJoin\Traits\EloquentJoin;
|
|
|
|
class Category extends Model
|
|
{
|
|
use InteractsWithMedia, Taggable;
|
|
|
|
protected $guarded = ['id'];
|
|
protected $table = 'shop_categories';
|
|
|
|
public function Articles()
|
|
{
|
|
return $this->morphedByMany('App\Models\Shop\Article', 'categorizable');
|
|
}
|
|
|
|
public function Shelves()
|
|
{
|
|
return $this->morphedByMany('App\Models\Shop\Category', 'categorizable');
|
|
}
|
|
|
|
public function CategoryTree()
|
|
{
|
|
return $this->belongsTo(app('rinvex.categories.category'),'category_id');
|
|
}
|
|
|
|
}
|