You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
willaengine/app/Category.php

123 lines
2.6 KiB

<?php
namespace App;
//use App\Appended\Traites\UpdateModels;
use Illuminate\Database\Eloquent\Model;
use Kalnoy\Nestedset\NodeTrait;
class Category extends Model
{
// use UpdateModels;
use NodeTrait;
protected $fillable = ['name_en','business_id', 'name_fa', 'type', 'slug', 'sipping_wight', 'language', 'priority', 'parent_id', 'additional_attributes', 'additional_view', 'specification_fields'];
protected $hidden = ['pivot'];
public function parent()
{
return $this->belongsTo('App\Category', 'parent_id');
}
public function business_title()
{
return $this->hasMany('App\BusinessTitle');
}
public function attributes()
{
return $this->hasMany('App\Attribute');
}
public function order_variation()
{
return $this->belongsToMany('App\Attribute')->where('for_section', 'Order');
}
public function children()
{
return $this->hasMany('App\Category', 'parent_id');
}
public function products()
{
return $this->hasMany('App\Product');
}
public function brands()
{
return $this->belongsToMany('App\Brand');
}
public function business_categories()
{
return $this->belongsToMany('App\Business');
}
public function business()
{
return $this->hasMany('App\Business');
}
public function business_items()
{
return $this->hasMany('App\BusinessItem');
}
public function templates()
{
return $this->hasMany('App\SpTemplate');
}
public function user_templates()
{
return $this->hasManyThrough('App\SpUserTemplate', 'App\SpTemplate', 'category_id', 'sp_template_id', 'id', 'id');
}
//////////////
public function c_attributes()
{
return $this->belongsToMany('App\Attribute', 'attribute_category');
}
public function news()
{
return $this->belongsToMany('App\News');
}
public function businesses()
{
return $this->belongsToMany('App\Business');
}
public function portfolios()
{
return $this->hasMany('App\Portfolio');
}
public function shipping_groups()
{
return $this->belongsToMany('App\ShippingGroup');
}
public function shipping_group_business()
{
return $this->belongsToMany('App\ShippingGroup')->where('business_id', session('ActiveBusiness'));
}
//override action methods and delete caches
protected function clearCacheItems()
{
// dd('rrrr/rrrrun');
Cache::forget('main_categories');
}
protected function updateRelatedFiles()
{
}
}