<?php

namespace App\Classes\Modules\Orders\Services;

use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\ValueObjects\Constants\BusinessType;
use App\Models\Company;

class UpdatesOrdersStatus extends AbstractUpdateRecord
{

    /**
     * @param Company $model
     * @param int $status
     * @return \Illuminate\Database\Eloquent\Model
     */
    public function execute(Company $model, int $status)
    {
        return $model->companyModules()->where('type', BusinessType::IMPORTER)->first()->orders()->update(['status' => $status]);

    }
}