# fluent-support/1.5.2/app/Models/Product.php

Fluent Support – Helpdesk &amp; Customer Support Ticket System, version 1.5.2. 51 lines.

- Page: https://pluginprobe.com/plugins/fluent-support/1.5.2/code/app/Models/Product.php
- Raw: https://pluginprobe.com/plugins/fluent-support/1.5.2/raw/app/Models/Product.php
- Modified: 2021-11-12T14:57:38+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-support/1.5.2/code/app/Models/Product.php#L10-L20`.

```php
<?php

namespace FluentSupport\App\Models;

class Product extends Model
{
    protected $table = 'fs_products';


    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'source_uid',
        'title',
        'description',
        'settings',
        'source',
        'created_by'
    ];

    protected $searchable = ['title', 'description'];

    /**
     * Local scope to filter products by search/query string
     * @param ModelQueryBuilder $query
     * @param string $search
     * @return ModelQueryBuilder
     */

    public function scopeSearchBy($query, $search)
    {
        if ($search) {
            $fields = $this->searchable;
            $query->where(function ($query) use ($fields, $search) {
                $query->where(array_shift($fields), 'LIKE', "%$search%");

                foreach ($fields as $field) {
                    $query->orWhere($field, 'LIKE', "$search%");
                }
            });
        }

        return $query;
    }


}

```
