<?php

namespace App\Classes\Modules\PackingLists\Services\Containers;

use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord;
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
use App\Models\Remark;
use App\Models\Container;

class CreatesContainerRemark extends AbstractUpdateRelationshipRecord
{

    /**
     * @param Company $company
     * @param RemarkObject $object
     * @return \Illuminate\Database\Eloquent\Model
     * @throws \App\Classes\Exceptions\MalformedRequestException
     */
    public function execute(Container $container, RemarkObject $object) {
        $model = new Remark();

        $model->commenter_id = $object->getCommenterId();
        $model->content = $object->getContent();

        return $this->handler($container->remarks(), $model);

    }
}
