use Illuminate\Database\Query\Builder;
-use Laravel\SerializableClosure\Exceptions\PhpVersionNotSupportedException;
-use Laravel\SerializableClosure\SerializableClosure;
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;
$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();
$q = $q->$modelScope();
}
return $q->where('created_ok', 1)->get()->pluck($attr, $inst->getKeyName())->toArray();
- });
+ };
$ttl = 86400;
$cache = cache()->tags([$tag]);
if ($force) {