lundi 21 septembre 2015

use QueryScope in Blade template

I have define scope in model like this

class Station extends Model {

    protected $primaryKey = 'st_id';

    public function scopeByDid($query)
    {
        return $query->groupBy("st_did");
    }

}

I can call byDid from controller but I cannot get it through blade template like this

@foreach ($river->stations->byDid as $didType)
....
@endforeach

how do I get it. Appreciate your response. Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire