Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
50.00% |
1 / 2 |
CRAP | |
50.00% |
1 / 2 |
Site | |
0.00% |
0 / 1 |
|
50.00% |
1 / 2 |
2.50 | |
50.00% |
1 / 2 |
resolveRouteBinding | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
serializeDate | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
1 | <?php |
2 | |
3 | namespace Qmp\Laravel\Site\Models; |
4 | |
5 | use Illuminate\Database\Eloquent\Model; |
6 | |
7 | class Site extends \Moloquent |
8 | { |
9 | protected $connection = 'siteMongo'; |
10 | protected $collection = 'sites'; |
11 | protected $fillable = ['hash', 'siteUrl', 'siteName', 'tracker', 'brand', 'company']; |
12 | |
13 | public function resolveRouteBinding($value, $field = null) |
14 | { |
15 | return $this->where('_id', $value)->first() ?? abort(422, 'Datas not found'); |
16 | } |
17 | |
18 | /** |
19 | * Prepare a date for array / JSON serialization. |
20 | * |
21 | * @param \DateTimeInterface $date |
22 | * @return string |
23 | */ |
24 | protected function serializeDate(\DateTimeInterface $date) |
25 | { |
26 | return $date->format('Y-m-d H:i:s'); |
27 | } |
28 | } |