MicroFrameWork/kernel/app_modules/photo/services/PhotoService.php

34 lines
826 B
PHP
Raw Normal View History

2024-11-29 13:23:48 +03:00
<?php
namespace kernel\app_modules\photo\services;
use kernel\app_modules\photo\models\Photo;
use kernel\FormModel;
use kernel\helpers\Debug;
class PhotoService
{
public function create(FormModel $form_model): false|Photo
{
$model = new Photo();
$model->image = $form_model->getItem('image');
$model->entity = $form_model->getItem('entity');
$model->entity_id = $form_model->getItem('entity_id');
return false;
}
public function update(FormModel $form_model, Photo $photo): false|Photo
{
$photo->image = $form_model->getItem('image');
$photo->entity = $form_model->getItem('entity');
$photo->entity_id = $form_model->getItem('entity_id');
if ($photo->save()){
return $photo;
}
return false;
}
}