diff --git a/models/Page.php b/models/Page.php index 2320d87..95202c0 100644 --- a/models/Page.php +++ b/models/Page.php @@ -88,4 +88,12 @@ class Page extends Model return static::whereType($type)->get()->pluck('name', 'id')->toArray(); } + + public static function forSelect(): array + { + return static::orderByRaw('type, name') + ->selectRaw('id, CONCAT(name, " (", type, ")") AS name') + ->pluck('name', 'id') + ->toArray(); + } }