I have two credit cards (through the same bank).  The first I got at age 18, and the 2nd I applied for while in grad school for better rewards.  I use credit cards (primarily the more recent one) for routine monthly expenses and I pay them off in full every month and reap the rewards.  The limits were pretty low while I was in school, but every 6 months or so they would notify me that they were raising my credit limit by a modest amount.  This continued for a while, but it stopped not long after I left school (which roughly coincided with banks becoming more reluctant to offer credit).

My income has increased several hundred percent over what it was while I was in grad school, and I feel my credit limits do not reflect that.  My combined credit limit between the two cards is a little over 12% of my yearly gross income.  I feel this is probably low, and I might like to increase it both to increase my credit score and to easier allow for multiple large purchases (computer, furniture, etc.) in the same month without using an excessively high portion of my available credit.  What guidelines should I use to determine how much of an increase, if any, to request?


Question: Laravel eloquent how to order collection by accessor in appends array
Answer: You can sort the resulting collection by accessor, obviously the query can't be ordered, for it's not in the db.

$songs = Song::all(); // get the result
$songs-&gt;sortByDesc('lastDate'); // sort using collection method

// or ascending:
$songs-&gt;sortBy('lastDate');


You could achieve the same using joins, if you prefer to do this in the db call (it's better in terms of performance).



Another thing: you use if( ! $this-&gt;events) which will cause trouble soon.

Check this out:

// hasOne / belongsTo / morphTo etc - single relations
$model-&gt;relation; // returns related model OR null -&gt; evaluates to false

// BUT for hasMany / belongsToMany etc - multiple results
$model-&gt;relation; // always returns a collection, even if empty, evaluates to true


So change this if to:

public function getLastDateAttribute()
{
    if ( ! count($this-&gt;events)) return null;

    return $this-&gt;events[0]-&gt;date-&gt;formatLocalized('%d.%m.%Y (%a, %Hч)');
}}