GroupHasMemberFilter.php 1.46 KB
<?php

namespace App\ModelFilters;

use App\Support\ModelFilter;

class GroupHasMemberFilter extends ModelFilter
{
    public function memberNickName(string $name): void
    {
        $this->whereRelation('member', 'nick_name', 'like', '%' . $name . '%');
    }

    public function memberRealName(string $name): void
    {
        $this->whereRelation('member', 'real_name', 'like', '%' . $name . '%');
    }

    public function memberEmailLike(string $email): void
    {
        $this->whereRelation('member', 'email', 'like', '%' . $email . '%');
    }

    public function memberPhoneLike(string $phone): void
    {
        $this->whereRelation('member', 'phone', 'like', '%' . $phone . '%');
    }

    public function memberOfficialStatus(int $status): void
    {
        $this->whereRelation('member', 'official_status', $status);
    }

    public function memberStatus(int $status): void
    {
        $this->whereRelation('member', 'status', $status);
    }

    public function member(int $memberId): void
    {
        $this->where('member_id', $memberId);
    }

    public function master(int $masterId): void
    {
        $this->whereRelation('master', 'users.id', $masterId);
    }

    public function role(int $role): void
    {
        $this->where('role', $role);
    }

    public function status(int $status): void
    {
        $this->where('status', $status);
    }

    public function group(int $group): void
    {
        $this->where('group_id', $group);
    }
}