src/Metable.php
public function scopeOrderByMeta(Builder $q, string $key, string $direction = 'asc', $strict = false)
    {
        $table = $this->joinMetaTable($q, $key, $strict ? 'inner' : 'left');
        $q->orderBy("{$table}.value", $direction);
    }
public function scopeOrderByMeta(Builder $q, string $key, string $direction = 'asc', $strict = false)
    {
        $table = $this->joinMetaTable($q, $key, $strict ? 'inner' : 'left');
        $q->orderBy("{$table}.value", $direction);
    }
public function scopeOrderByMeta ( Builder $ q , string $ key , string $ direction = 'asc' , $ strict = false ) { $ table = $ this -> joinMetaTable ( $ q , $ key , $ strict ? 'inner' : 'left' ) ; $ q -> orderBy ( "{$table}.value" , $ direction ) ; }
Query scope to order the query results by the string value of an attached meta.

@param Builder $q
@param string  $key
@param string  $direction
@param bool    $strict    if true, will exclude records that do not have meta for the provided `$key`.

@return void
Query scope to order the query results by the string value of an attached meta .