]> _ Git - cubist_cms-back.git/commitdiff
fix #2958 @0:10
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 23 Aug 2019 10:20:05 +0000 (12:20 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 23 Aug 2019 10:20:05 +0000 (12:20 +0200)
src/app/Magic/Fields/Model.php
src/app/Magic/Models/CubistMagicAbstractModel.php

index 2560653f2c08927101bbd38a0db9863dc964a9eb..feec9cb75c1d9d39dabbd812cb017776f9487e05 100644 (file)
@@ -28,7 +28,8 @@ class Model extends Field
         $modelClass = $this->getAttribute('optionsmodel');
         $inst = new $modelClass();
 
-        return $modelClass::all()->pluck($this->getAttribute('attribute'), $inst->getPrimaryKey())->toArray();
+        $attr=$this->getAttribute('attribute');
+        return $modelClass::orderBy($attr)->get()->pluck($attr, $inst->getPrimaryKey())->toArray();
     }
 
     public function getDatabaseType()
index 21ede78b9977eb8cbc40648a49990ee17e68f071..88cddbe9c74608e00bb9e13d2e12198dc9f8d5eb 100644 (file)
@@ -152,7 +152,6 @@ class CubistMagicAbstractModel extends Model implements HasMedia
     // The slug is created automatically from the "title" field if no slug exists.
     public function getSlugOrTitleAttribute()
     {
-
         foreach ($this->_slugFields as $item) {
             if (isset($this->$item) && $this->item != '') {
                 return $this->$item;