Completed
Push — master ( 03af29...6d12c1 )
by Vincenzo
02:16
created

SlimeModel::scopePage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
3
namespace App\Lib\Slime\Models;
4
5
use Illuminate\Database\Eloquent\Model as Eloquent;
6
7
class SlimeModel extends Eloquent
8
{
9
10
    public static function scopePage($query, $pagination)
11
    {
12
        $limit = $pagination['limit'];
13
        $offset = ($pagination['page'] - 1) * $pagination['limit'];
14
        return $query->take($limit)->skip($offset);
15
    }
16
17
}