imageSlotRepository->getSlots();
/** @var ImageSlot $slot */
foreach($slots as $slot) {
#echo $slot->slotName . '
';
if($slot->image !== null) {
# echo $slot->image->filename . '
';
}
$slotName = $slot->slotName;
}
return new ViewResult('imageslots', new MetaData('Image Slots', 'Image Slots'), [
'slotName' => $slotName,
'slots' => $slots,
]);
}
#[Auth]
#[Route('/admin/imageslots/{slotName}', method: Method::POST)]
public function update(string $slotName): ViewResult
{
$slot = $this->imageSlotRepository->findBySlotName(urldecode($slotName));
$slotName = $slot->slotName;
#echo "";
return new ViewResult('imageslot', new MetaData('Image Slot', 'Image Slots'), [
'slotName' => $slotName,
'id' => $slot->id,
]);
}
#[Auth]
#[Route('/admin/imageslots/create', method: Method::POST)]
public function create(Request $request)
{
$name = $request->parsedBody->get('slotName');
$slot = new ImageSlot(0, $name, '');
$this->imageSlotRepository->save($slot);
debug($name);
}
#[Auth]
#[Route('/admin/imageslots/edit/{id}', method: Method::PUT)]
public function edit(Request $request, string $id)
{
$name = $request->parsedBody->get('slotName');
$slot = $this->imageSlotRepository->findById((int)$id);
$slot = new ImageSlot($slot->id, $name, $slot->imageId);
$this->imageSlotRepository->save($slot);
}
}