Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
6 / 6 |
| Entity | |
100.00% |
1 / 1 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
6 / 6 |
| getExternalfrontconfigAttribute | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
| getExternalusersAttribute | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| getExternalfronturlAttribute | |
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\Entities\Models; |
| 4 | |
| 5 | |
| 6 | use Illuminate\Support\Arr; |
| 7 | use Illuminate\Support\Str; |
| 8 | use Qmp\Laravel\MicroService\Client\Client; |
| 9 | use Qmp\Laravel\MicroService\Client\Tools\Request as ClientRequest; |
| 10 | |
| 11 | class Entity extends \Moloquent |
| 12 | { |
| 13 | protected $connection = 'entitiesMongo'; |
| 14 | protected $collection = 'entities'; |
| 15 | protected $primaryKey = 'id'; |
| 16 | |
| 17 | protected $guarded = ['_id']; |
| 18 | protected $hidden = ['_id']; |
| 19 | |
| 20 | public function getExternalfrontconfigAttribute() |
| 21 | { |
| 22 | return collect($this->config)->filter(function ($config) { |
| 23 | return $config['id'] === 4; |
| 24 | })->first(); |
| 25 | } |
| 26 | |
| 27 | public function getExternalusersAttribute() |
| 28 | { |
| 29 | return collect($this->externalfrontconfig)->get('external-users'); |
| 30 | } |
| 31 | |
| 32 | public function getExternalfronturlAttribute() |
| 33 | { |
| 34 | return collect($this->externalfrontconfig)->get('url'); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Prepare a date for array / JSON serialization. |
| 39 | * |
| 40 | * @param \DateTimeInterface $date |
| 41 | * @return string |
| 42 | */ |
| 43 | protected function serializeDate(\DateTimeInterface $date) |
| 44 | { |
| 45 | return $date->format('Y-m-d H:i:s'); |
| 46 | } |
| 47 | } |