Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
「Eloquent ORM」で「自然順序」を取得するにはどうすればよいですか? テーブルには、列「テキスト」(文字列)があります。 通常の順序: Model::orderBy('text')
'value 1' 'value 12' 'value 23' 'value 3' 'value 8'
私はこれを必要とする:
'value 1' 'value 3' 'value 8' 'value 12' 'value 23'
何か案は?
Laravelの場合、これも機能します:
$collection = $collection->sortBy('order', SORT_NATURAL, true);