<?php


namespace App\Modules\Push\Models;


use Illuminate\Database\Eloquent\Model;

class QappPushTaskUsers extends Model
{
    protected $table = 'qapp_push_task_users';
    protected $fillable = ['uid', 'app_id', 'task_id', 'task_log_id'];

    /**
     * @param $taskId
     * @return array
     */
    public static function getTaskUsers($taskId): array
    {
        if (empty($taskId)) {
            return [];
        }

        $result = self::where('task_id', $taskId)->get();
        return $result ? $result->toArray() : [];
    }

}