jeudi 3 décembre 2015

Laravel 5.1 use limit in with() method of eloquent

Eloquent

$staffGroup = StaffGroup::where('id', $id)
            ->with('staffGroupRight')
            ->first();

In StaffGroup Model:

public function staffGroupRight() {
    return $this->hasMany('Modules\Staff\Http\Models\StaffGroupRight');
}

here with staffGroupRight return data appropriate to id of staff group.

but i want to set limit in that with() method data.

is it possible to set limit in with() method or not...??



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire