Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
2 / 2 |
| Config | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
2 / 2 |
| resolveRouteBinding | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| serializeDate | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace Qmp\Laravel\Tracker\Models; |
| 4 | |
| 5 | class Config extends \Moloquent |
| 6 | { |
| 7 | protected $connection = 'trackerMongo'; |
| 8 | protected $collection = 'config'; |
| 9 | protected $primaryKey = 'id'; |
| 10 | |
| 11 | protected $guarded = ['_id']; |
| 12 | protected $hidden = ['_id']; |
| 13 | |
| 14 | public function resolveRouteBinding($value, $field = null) |
| 15 | { |
| 16 | return $this->where('id', $value)->first() ?? abort(422, 'Datas not found'); |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * Prepare a date for array / JSON serialization. |
| 21 | * |
| 22 | * @param \DateTimeInterface $date |
| 23 | * @return string |
| 24 | */ |
| 25 | protected function serializeDate(\DateTimeInterface $date) |
| 26 | { |
| 27 | return $date->format('Y-m-d H:i:s'); |
| 28 | } |
| 29 | } |