Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
2 / 2 |
Site | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
2 / 2 |
users | |
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\ExternalUsers\Models; |
4 | |
5 | use Illuminate\Database\Eloquent\Model; |
6 | |
7 | class Site extends Model |
8 | { |
9 | protected $connection = 'externalUsers'; |
10 | protected $table = 'sites'; |
11 | |
12 | protected $fillable = ['name', 'url']; |
13 | |
14 | |
15 | public function users() |
16 | { |
17 | return $this->belongsToMany(User::class)->withTimestamps(); |
18 | } |
19 | |
20 | |
21 | /** |
22 | * Prepare a date for array / JSON serialization. |
23 | * |
24 | * @param \DateTimeInterface $date |
25 | * @return string |
26 | */ |
27 | protected function serializeDate(\DateTimeInterface $date) |
28 | { |
29 | return $date->format('Y-m-d H:i:s'); |
30 | } |
31 | |
32 | |
33 | } |