Completed
Push — master ( f65d8f...4f3de5 )
by Pavel
04:14 queued 01:54
created

MaxPerPageScope::apply()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 2
dl 0
loc 4
rs 10
1
<?php
2
3
namespace App\Scopes;
4
5
use Illuminate\Database\Eloquent\Scope;
6
use Illuminate\Database\Eloquent\Model;
7
use Illuminate\Database\Eloquent\Builder;
8
9
class MaxPerPageScope implements Scope
10
{
11
    /**
12
     * Maximum count items in response
13
     */
14
    const MAX_PER_PAGE = 100;
15
16
    public function apply(Builder $builder, Model $model)
17
    {
18
        return $builder->take(self::MAX_PER_PAGE);
19
    }
20
}