| Total Complexity | 3 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 3 | ||
| 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 string $column; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var string Direction to order results (asc or desc) |
||
| 18 | */ |
||
| 19 | private string $direction; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var bool Raw OrderBy clause to order null values last |
||
| 23 | */ |
||
| 24 | private bool $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', bool $raw = false) |
||
| 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): void |
||
| 58 |