<?php

namespace App\Classes\Modules\PackingLists\Services;

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\PackingList;

class CreatesPackingListRemark extends AbstractUpdateRelationshipRecord
{

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

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

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

    }
}
