Files
ikea/app/Models/IkeaProducts.php
Jaroslav Drzik 3cfa2e3513
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
Basic search
2023-12-05 21:49:32 +01:00

36 lines
683 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) {
return $this->where('typeName', 'LIKE', '%' . $item . '%')->orWhere('name', 'LIKE', '%' . $item . '%')->get();
} else {
return [];
}
}
}