Passed
Push — master ( 348272...316c2a )
by Giacomo
14:14
created

MDModel   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 5
Bugs 1 Features 0
Metric Value
eloc 10
c 5
b 1
f 0
dl 0
loc 36
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getRandom() 0 3 1
A getId() 0 3 1
A getCollection() 0 3 1
1
<?php
2
namespace OfflineAgency\MongoAutoSync\Http\Models;
3
4
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
5
use OfflineAgency\MongoAutoSync\Traits\ModelAdditionalMethod;
6
use OfflineAgency\MongoAutoSync\Traits\MongoSyncTrait;
7
8
class MDModel extends Eloquent
9
{
10
    use MongoSyncTrait, ModelAdditionalMethod;
0 ignored issues
show
Bug introduced by
The trait OfflineAgency\MongoAutoSync\Traits\MongoSyncTrait requires the property $ref_id which is not provided by OfflineAgency\MongoAutoSync\Http\Models\MDModel.
Loading history...
introduced by
The trait OfflineAgency\MongoAutoS...s\ModelAdditionalMethod requires some properties which are not provided by OfflineAgency\MongoAutoSync\Http\Models\MDModel: $author, $mongoRelation, $description, $items, $shortDescription, $img_evidence_text, $excerption, $title
Loading history...
11
12
    protected $connection = 'mongodb';
13
    protected $dates = [
14
        'deleted_at',
15
        'created_at',
16
        'updated_at'
17
    ];
18
19
    /**
20
     * @return mixed
21
     */
22
    public function getId()
23
    {
24
        return $this->id;
25
    }
26
27
    /**
28
     * @return string
29
     */
30
    public function getCollection()
31
    {
32
        return $this->collection;
33
    }
34
35
    /**
36
     *
37
     * @param int $size
38
     *
39
     * @return mixed
40
     */
41
    public function getRandom($size = 3)
42
    {
43
        return $this->all()->random($size);
44
    }
45
}
46