You could add a raw query and do something like this:
Model::orderBy(DB::raw('LENGTH(text), text'));
Or, in modern versions of Laravel:
Model::orderByRaw('LENGTH(text), text');
More Related Contents:
- How to Merge Two Eloquent Collections?
- Laravel one to many relation with a one to one relation
- How to Create Multiple Where Clause Query Using Laravel Eloquent?
- How do I get the query builder to output its raw SQL query as a string?
- Get the Last Inserted Id Using Laravel Eloquent
- Bulk Insertion in Laravel using eloquent ORM
- Laravel Check If Related Model Exists
- Laravel, sync() – how to sync an array and also pass additional pivot fields?
- Laravel Model with Two Primary Keys update [duplicate]
- Laravel eager loading with limit
- Laravel OrderBy relationship count
- Laravel 5.2 – Use a String as a Custom Primary Key for Eloquent Table becomes 0
- Laravel Eloquent: How to order results of related models?
- Laravel 4: how to “order by” using Eloquent ORM [duplicate]
- How to set a default attribute value for a Laravel / Eloquent model?
- Laravel $q->where() between dates
- Laravel – Database, Table and Column Naming Conventions?
- Order By before Group By using Eloquent (Laravel)
- How to Make Laravel Eloquent “IN” Query?
- Update without touching timestamps (Laravel)
- Difference between Eloquent\Model::get() and all()
- Laravel Eloquent sort by relation table column
- Laravel 4.1: How to paginate eloquent eager relationship?
- Laravel Eloquent: How to get only certain columns from joined tables
- How can I query raw via Eloquent?
- A __construct on an Eloquent Laravel Model
- How to get last insert id in Eloquent ORM laravel
- Laravel Many to many self referencing table only works one way
- Laravel collection converts array to object
- Merge ‘with’ and ‘whereHas’ in Laravel 5