From df1d0935a81681cc7c44c898a0ce239856940968 Mon Sep 17 00:00:00 2001 From: Reza Amini Date: Thu, 15 Jul 2021 23:56:30 +0430 Subject: [PATCH] Better config maker --- src/Commands/Actions/MakeCRUD.php | 2 +- src/Commands/stub/crud.stub | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/Commands/Actions/MakeCRUD.php b/src/Commands/Actions/MakeCRUD.php index 2cd43c5..49d162d 100644 --- a/src/Commands/Actions/MakeCRUD.php +++ b/src/Commands/Actions/MakeCRUD.php @@ -24,7 +24,7 @@ public function handle() $config = config("easy_panel.crud.$name"); if (!$config) { - throw new CommandNotFoundException("There is no {$name} in config file"); + throw new CommandNotFoundException("{$name} has not been set in config/easy_panel.php file"); } $this->modelNameIsCorrect($name, $config['model']); diff --git a/src/Commands/stub/crud.stub b/src/Commands/stub/crud.stub index 79c82fe..0cc785a 100644 --- a/src/Commands/stub/crud.stub +++ b/src/Commands/stub/crud.stub @@ -4,7 +4,7 @@ return [ 'model' => {{ model }}::class, // searchable fields, if you dont want search feature, remove it - 'search' => [{{ searchFields }}], + 'search' => [{{ fields }}], // Manage actions in crud 'create' => true, @@ -24,17 +24,11 @@ return [ // Write every fields in your db which you want to have a input // Available types : "ckeditor", "text", "file", "textarea", "password", "number", "email", "select" - 'fields' => [ - 'title' => 'text', - 'content' => 'textarea', - 'image' => 'file' - ], + 'fields' => [], // Where files will store for inputs - 'store' => [ - 'image' => 'images/articles' - ], + 'store' => [], // which kind of data should be showed in list page - 'show' => ['title', 'content', ['user' => 'name']], + 'show' => [{{ fields }}], ];