]> _ Git - cubist_cms-back.git/commitdiff
wip #2628 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 12 Mar 2019 17:10:06 +0000 (18:10 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 12 Mar 2019 17:10:06 +0000 (18:10 +0100)
src/app/Http/Controllers/TemplateCrudController.php
src/app/Models/Template.php

index ce97aacf0452fadd0abdd108c9c89f686a3c9793..fd3cd8877ae9965146dcae1aa089288a410e3cd2 100644 (file)
@@ -13,32 +13,25 @@ class TemplateCrudController extends CrudController
     {
         parent::setup();
 
-        $this->crud->setModel("Cubist\Backpack\app\Models\Setting");
-        $this->crud->setEntityNameStrings(trans('backpack::settings.setting_singular'), trans('backpack::settings.setting_plural'));
-        $this->crud->setRoute(backpack_url('setting'));
+        $this->crud->setModel("Cubist\Backpack\app\Models\Template");
+        $this->crud->setEntityNameStrings(trans('cubist_back::templates.template_singular'), trans('cubist_back::templates.template_plural'));
+        $this->crud->setRoute(backpack_url('template'));
         $this->crud->addClause('where', 'active', 1);
         $this->crud->denyAccess(['create', 'delete']);
         $this->crud->setColumns([
             [
                 'name' => 'name',
-                'label' => trans('backpack::settings.name'),
-            ],
-            [
-                'name' => 'value',
-                'label' => trans('backpack::settings.value'),
+                'label' => trans('cubist_back::templates.name'),
             ],
             [
                 'name' => 'description',
-                'label' => trans('backpack::settings.description'),
+                'label' => trans('cubist_back::templates.description'),
             ],
         ]);
         $this->crud->addField([
             'name' => 'name',
-            'label' => trans('backpack::settings.name'),
+            'label' => trans('cubist_back::templates.name'),
             'type' => 'text',
-            'attributes' => [
-                'disabled' => 'disabled',
-            ],
         ]);
     }
 
index fc5a7a0a65968f93300dbfb9b3b4c081fe151db6..f392bdaae12e5eee58cde27dfccc52777f3a2f4b 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Backpack\Settings\app\Models;
+namespace Cubist\Backpack\app\Models;
 
 use Backpack\CRUD\CrudTrait;
 use Config;
@@ -11,7 +11,7 @@ class Template extends Model
     use CrudTrait;
 
     protected $table = 'cubist_templates';
-    protected $fillable = ['value'];
+    protected $fillable = ['name','description','parent',''];
 
     /**
      * Grab a setting value from the database.
@@ -40,7 +40,7 @@ class Template extends Model
      */
     public static function set($key, $value = null)
     {
-        $prefixed_key = 'settings.'.$key;
+        $prefixed_key = 'template.'.$key;
         $setting = new self();
         $entry = $setting->where('key', $key)->firstOrFail();