43 lines
968 B
PHP
43 lines
968 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class IkeaProducts extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 't_ikea_products';
|
|
|
|
/**
|
|
* The primary key associated with the table.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $primaryKey = null;
|
|
/**
|
|
* Indicates if the model's ID is auto-incrementing.
|
|
*
|
|
* @var bool
|
|
*/
|
|
public $incrementing = false;
|
|
|
|
protected function search($item)
|
|
{
|
|
if (strlen($item) >= 3 && strlen($item) <= 5) {
|
|
return $this->where('name', 'LIKE', '%' . $item . '%')->get();
|
|
} else if (strlen($item >= 5)) {
|
|
return $this->where('typeName', 'LIKE', '%' . $item . '%')->orWhere('name', 'LIKE', '%' . $item . '%')->get();
|
|
} else {
|
|
return [];
|
|
}
|
|
}
|
|
|
|
protected function multisearch($codes, $countries) {
|
|
//$countries = $
|
|
// return $this->where('code',$codes)->where('country',$countries);
|
|
}
|
|
}
|