Query

Fetching all rows (Collection)

$collection = (new Foos())
    ->all();

Fetching single row (Record)

$record = (new Foos())
    ->one();

Applying filters

$records = (new Foos())
    ->where('foo', 'value')
    ->where('bar', 10, '>=')
    ->all();

Sorting data

$records = (new Foos())
    ->orderBy('foo', 'DESC')
    ->all();

Joining relations

Applying limits

Lazy loading

Eager loading

Counting data

Last updated

Was this helpful?