Reviewed-on: https://codeberg.org/lvl0/trip-planner/pulls/34 Co-authored-by: myrmidex <myrmidex@myrmidex.net> Co-committed-by: myrmidex <myrmidex@myrmidex.net>
22 lines
507 B
PHP
22 lines
507 B
PHP
<?php
|
|
|
|
namespace App\Domain\PlannedItem\Actions;
|
|
|
|
use App\Models\PlannedItem;
|
|
|
|
class UpdatePlannedItemAction
|
|
{
|
|
/**
|
|
* Update a planned item's properties
|
|
*
|
|
* @param PlannedItem $plannedItem
|
|
* @param array $data ['calendar_slot_id'?, 'sort_order'?]
|
|
* @return PlannedItem
|
|
*/
|
|
public function execute(PlannedItem $plannedItem, array $data): PlannedItem
|
|
{
|
|
$plannedItem->update($data);
|
|
|
|
return $plannedItem->load(['plannableItem', 'calendarSlot']);
|
|
}
|
|
}
|