| Total Complexity | 3 | 
| Total Lines | 49 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 9 | class OrderScope implements Scope | ||
| 10 | { | ||
| 11 | /** | ||
| 12 | * @var string Name of the column that identifies order | ||
| 13 | */ | ||
| 14 | private $column; | ||
| 15 | |||
| 16 | /** | ||
| 17 | * @var string Direction to order results (asc or desc) | ||
| 18 | */ | ||
| 19 | private $direction; | ||
| 20 | |||
| 21 | /** | ||
| 22 | * @var bool Raw OrderBy clause to order null values last | ||
| 23 | */ | ||
| 24 | private $raw; | ||
| 25 | |||
| 26 | /** | ||
| 27 | * OrderOrderScope constructor. | ||
| 28 | * | ||
| 29 | * @param string $column | ||
| 30 | * @param string $direction | ||
| 31 | * @param bool $raw | ||
| 32 | */ | ||
| 33 | public function __construct(string $column = 'order', string $direction = 'desc', $raw = false) | ||
| 34 |     { | ||
| 35 | $this->column = $column; | ||
| 36 | $this->direction = ucwords($direction); | ||
| 37 | $this->raw = $raw; | ||
| 38 | } | ||
| 39 | |||
| 40 | /** | ||
| 41 | * Apply the scope to a given Eloquent query builder. | ||
| 42 | * | ||
| 43 | * @param Builder $builder | ||
| 44 | * @param Model $model | ||
| 45 | * @return void | ||
| 46 | */ | ||
| 47 | public function apply(Builder $builder, Model $model) | ||
| 58 | } | ||
| 59 | } | ||
| 61 |