<?php

namespace App\Classes\Modules\Companies\Services;

use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
use App\Models\Company;

class UpdatesCompany extends AbstractUpdateRecord
{

    /**
     * @param Company $model
     * @param CompanyObject $object
     * @return \Illuminate\Database\Eloquent\Model
     * @throws \App\Classes\Exceptions\MalformedRequestException
     */
    public function execute(Company $model, CompanyObject $object)
    {
        $model->name = $object->getName();
        $model->reference = $object->getReference();
        $model->type = $object->getType();

        return $this->handler($model);
    }
}
