OrderByCreatedTimeTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 22
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A filterNewest() 0 4 1
A filterEarliest() 0 4 1
1
<?php
2
3
/**
4
 * Created by PhpStorm.
5
 * User: xuan
6
 * Date: 9/24/15
7
 * Time: 9:55 AM.
8
 */
9
namespace PHPHub\Repositories\Criteria;
10
11
trait OrderByCreatedTimeTrait
12
{
13
    /**
14
     * 按创建时间倒序排列.
15
     *
16
     * @param $model
17
     */
18
    public function filterNewest($model)
19
    {
20
        return $model->orderBy('created_at', 'desc');
21
    }
22
23
    /**
24
     * 按创建时间正序排列.
25
     *
26
     * @param $builder
27
     */
28
    public function filterEarliest($builder)
29
    {
30
        return $builder->orderBy('created_at', 'asc');
31
    }
32
}
33