]> _ Git - cubist_cms-back.git/commitdiff
wip #5399
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 19 Aug 2022 16:28:52 +0000 (18:28 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 19 Aug 2022 16:28:52 +0000 (18:28 +0200)
src/app/Magic/Fields/Model.php

index 205757f5cc6ab2a6ec7b12105b61bb1f2196235e..d801b7d70bc21168e2c6ea6f30898e086aa026a8 100644 (file)
@@ -5,8 +5,6 @@ namespace Cubist\Backpack\Magic\Fields;
 
 
 use Illuminate\Database\Query\Builder;
-use Laravel\SerializableClosure\Exceptions\PhpVersionNotSupportedException;
-use Laravel\SerializableClosure\SerializableClosure;
 
 class Model extends Field
 {
@@ -31,9 +29,6 @@ class Model extends Field
         $this->pluck($this->getAttribute('attribute'), true, $force);
     }
 
-    /**
-     * @throws PhpVersionNotSupportedException
-     */
     public function pluck($attr, $onlyGlobal = false, $force = false)
     {
         $bui = backpack_user() === null ? '' : backpack_user()->id;
@@ -48,7 +43,7 @@ class Model extends Field
         $tag = 'model_' . $modelClass;
         if ($force || !isset(static::$_options[$globalCacheKey])) {
             start_measure($globalCacheKey, 'Get options for model ' . $modelClass . ' / ' . $attr);
-            $closure = new SerializableClosure(function () use ($modelClass, $attr, $modelScope) {
+            $closure = function () use ($modelClass, $attr, $modelScope) {
                 set_time_limit(0);
                 /** @var \Illuminate\Database\Eloquent\Model $inst */
                 $inst = new $modelClass();
@@ -58,7 +53,7 @@ class Model extends Field
                     $q = $q->$modelScope();
                 }
                 return $q->where('created_ok', 1)->get()->pluck($attr, $inst->getKeyName())->toArray();
-            });
+            };
             $ttl = 86400;
             $cache = cache()->tags([$tag]);
             if ($force) {