# fluent-support/2.1.2/app/Models/Agent.php

Fluent Support – Helpdesk &amp; Customer Support Ticket System, version 2.1.2. 68 lines.

- Page: https://pluginprobe.com/plugins/fluent-support/2.1.2/code/app/Models/Agent.php
- Raw: https://pluginprobe.com/plugins/fluent-support/2.1.2/raw/app/Models/Agent.php
- Modified: 2026-04-09T13:48:06+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/2.1.2/code/app/Models/Agent.php#L10-L20`.

```php
<?php

namespace FluentSupport\App\Models;

use FluentSupport\App\Models\Traits\AgentTrait;

class Agent extends Person
{
    use AgentTrait;

    protected static $type = 'agent';

    protected $searchable = [
        'id',
        'first_name',
        'last_name',
        'email',
        'address_line_1',
        'address_line_2',
        'country'
    ];

    /**
     * @return array
     */
    public function getSearchableFields(){
        return $this->searchable;
    }

    public static function boot()
    {
        parent::boot();

        static::creating(function ($model) {
            $model->person_type = static::$type;
            $model->hash = md5(time().wp_generate_uuid4());
        });

        static::addGlobalScope(function ($builder) {
            $builder->where('person_type', 'agent');
        });
    }


    /**
     * One2Many: Customer has to many Click Tickets
     * @return Model Collection
     */
    public function tickets()
    {
        $foreign_key = self::$type . '_id';

        $class = __NAMESPACE__ . '\Ticket';

        return $this->hasMany(
            $class, $foreign_key, 'id'
        );
    }

    public function groups()
    {
        return $this->belongsToMany(
            AgentGroup::class, 'fs_tag_pivot', 'source_id', 'tag_id'
        )->wherePivot('source_type', 'agent_group');
    }

}

```
