]> _ Git - cubist_cms-back.git/commitdiff
wip #3699 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 15 Jun 2020 13:30:20 +0000 (15:30 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 15 Jun 2020 13:30:20 +0000 (15:30 +0200)
composer.json
src/app/Magic/Fields/Checkbox.php
src/app/Magic/Models/CubistMagicAuthenticatable.php

index 535d9808f8d185593b15b511d7a56a57b9793cb1..e94fc787e459165d83ceba6c87a539e3fe8af05c 100644 (file)
@@ -45,7 +45,9 @@
         "chrisjean/php-ico": "^1.0",
         "swayok/alternative-laravel-cache": "^5.4",
         "genealabs/laravel-model-caching": "^0.8.0",
-        "backpack/revise-operation": "^1.0"
+        "backpack/revise-operation": "^1.0",
+        "digitallyhappy/toggle-field-for-backpack": "^2.0",
+        "calebporzio/parental": "^0.10.0"
     },
     "require-dev": {
         "filp/whoops": "^2.7",
index 763fe4cf13c1590288c81ddb10acce69f8efef10..650beadc6bf3e11d7ff71781e8d7596492deafee 100644 (file)
@@ -6,8 +6,9 @@ namespace Cubist\Backpack\app\Magic\Fields;
 
 class Checkbox extends Field
 {
-    protected $_adminType = 'checkbox';
+    protected $_adminType = 'toggle';
     protected $_databaseType = 'boolean';
     protected $_columnType = 'check';
     protected $_cast = 'boolean';
+    protected $_viewNamespace = 'toggle-field-for-backpack::fields';
 }
index 2ddbcdf697df4e372de640b9ffc33291fd019a7a..51036a68147907d10a3d9c21570c86807c0c6128 100644 (file)
@@ -3,6 +3,7 @@
 
 namespace Cubist\Backpack\app\Magic\Models;
 
+use Backpack\CRUD\app\Models\Traits\InheritsRelationsFromParentModel;
 use Backpack\CRUD\app\Notifications\ResetPasswordNotification;
 use Illuminate\Auth\Authenticatable;
 use Illuminate\Auth\MustVerifyEmail;
@@ -12,6 +13,7 @@ use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
 use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
 use Illuminate\Foundation\Auth\Access\Authorizable;
 use Illuminate\Notifications\Notifiable;
+use Parental\HasParent;
 use Spatie\Permission\Traits\HasRoles;
 
 class CubistMagicAuthenticatable extends CubistMagicAbstractModel
@@ -20,6 +22,7 @@ class CubistMagicAuthenticatable extends CubistMagicAbstractModel
     AuthorizableContract,
     CanResetPasswordContract
 {
+    use HasParent;
     use Authenticatable, Authorizable, CanResetPassword, MustVerifyEmail;
     use Notifiable;
     use HasRoles;
@@ -55,10 +58,10 @@ class CubistMagicAuthenticatable extends CubistMagicAbstractModel
             'type' => 'checkbox',
             'tab' => 'Login']);
 
-//        $this->addField(['name' => 'permissions',
-//            'label' => '',
-//            'type' => 'RolesPermissions',
-//            'tab' => 'Roles & Permissions']);
+        $this->addField(['name' => 'permissions',
+            'label' => '',
+            'type' => 'RolesPermissions',
+            'tab' => 'Roles & Permissions']);
 
         $this->addField(['name' => 'remember_token',
             'type' => 'Text',