@deron
To order by character and number in Laravel, you can use the orderByRaw method in your query builder. Here's an example:
1 2 3 |
$items = DB::table('items') ->orderByRaw('LENGTH(name), name') ->get(); |
In this example, we are sorting the items by the length of the name first, and then by the name itself. This will first sort the items by the number of characters in the name, and then alphabetically.
You can adjust the orderByRaw method according to your specific requirements.