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.
48 lines
903 B
48 lines
903 B
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Laravel\Scout\Searchable;
|
|
|
|
|
|
class Tag extends Model
|
|
{
|
|
use Searchable;
|
|
|
|
public $fillable = ['name', 'tag_group', 'type', 'category_id'];
|
|
|
|
public function businesses()
|
|
{
|
|
return $this->morphedByMany('App\Business', 'taggable');
|
|
}
|
|
|
|
public function business_items()
|
|
{
|
|
return $this->morphedByMany('App\BusinessItem', 'taggable');
|
|
}
|
|
|
|
public function products()
|
|
{
|
|
return $this->morphedByMany('App\Product', 'taggable');
|
|
}
|
|
|
|
public function news()
|
|
{
|
|
return $this->morphedByMany('App\News', 'taggable');
|
|
}
|
|
|
|
public function events()
|
|
{
|
|
return $this->morphedByMany('App\Event', 'taggable');
|
|
}
|
|
|
|
public function toSearchableArray()
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'name' => $this->name,
|
|
];
|
|
}
|
|
}
|