<?php

namespace Hilco\Models;

use DB;
use Hilco\Models\SelectsRelatedCount;

class KeyWord extends WebModel
{
	protected $table = 'KeyWords';
	protected $fillable = ['keyword'];

	public function object() {
		$this->morphTo();
	}

	public function scopeSearch($query, $word){
		$word = str_replace(',', ' ', $word);
		$searchArray = explode(' ',$word);
		return $query->whereIn('keyword', $searchArray);
	}

//	public static function saveKeyWords($object, $words){
//		$words = str_replace(',', ' ', $words);
//		$insertArray = explode(' ',$words);
//	}
}
