Add forSelect
This commit is contained in:
parent
51c4c32e51
commit
b6819225ed
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue