<?php

namespace App\Modules\SendOrder\Models;

use Illuminate\Database\Eloquent\Model;

class QappSendOrder extends Model
{
    protected $table = 'qapp_send_orders';
    protected $fillable = [
        'send_order_id',
        'account',
        'channel_user_id',
        'distribution_channel_id',
        'report_type',
        'report_rate',
        'first_charge_template_id',
        'second_charge_template_id',
    ];

    /**
     * @param $sendOrderId
     * @return array
     */
    public static function getSendOrderById($sendOrderId)
    {
        if (empty($sendOrderId)) {
            return [];
        }

        $result = self::where('send_order_id', $sendOrderId)->first();
        return $result ? $result->toArray() : [];
    }
}
