tags
This commit is contained in:
@ -35,7 +35,7 @@ class OptionService
|
||||
return false;
|
||||
}
|
||||
|
||||
public function createFromParams(string $key, string $value, string $label): false|Option
|
||||
public static function createFromParams(string $key, string $value, string $label): false|Option
|
||||
{
|
||||
$model = new Option();
|
||||
$model->key = $key;
|
||||
@ -63,6 +63,17 @@ class OptionService
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function removeOptionByKey(string $key): bool
|
||||
{
|
||||
$option = Option::where("key", $key)->first();
|
||||
if (!$option){
|
||||
return false;
|
||||
}
|
||||
|
||||
$option->delete();
|
||||
return true;
|
||||
}
|
||||
|
||||
// public function createOptionArr(): array
|
||||
// {
|
||||
// foreach (Option::all()->toArray() as $option) {
|
||||
|
@ -36,7 +36,7 @@ class PostController extends AdminController
|
||||
$post = $this->postService->create($postForm);
|
||||
|
||||
$entityRelation = new EntityRelation();
|
||||
$entityRelation->saveEntityRelation("post", new Request());
|
||||
$entityRelation->saveEntityRelation(entity: "post", model: $post, request: new Request());
|
||||
|
||||
if ($post) {
|
||||
$this->redirect("/admin/post/view/" . $post->id);
|
||||
|
@ -34,7 +34,7 @@ $form->field(class: \itguild\forms\inputs\Select::class, name: "user_id", params
|
||||
->render();
|
||||
|
||||
$entityRelations = new \kernel\EntityRelation();
|
||||
$entityRelations->renderEntityAdditionalPropertyFormBySlug("post");
|
||||
$entityRelations->renderEntityAdditionalPropertyFormBySlug("post", $model);
|
||||
|
||||
?>
|
||||
<div class="row">
|
||||
|
Reference in New Issue
Block a user