offline-agency /
laravel-mongo-auto-sync
| 1 | <?php |
||
| 2 | |||
| 3 | namespace OfflineAgency\MongoAutoSync\Http\Models; |
||
| 4 | |||
| 5 | use Jenssegers\Mongodb\Eloquent\Model as Eloquent; |
||
| 6 | use OfflineAgency\MongoAutoSync\Traits\Helper; |
||
| 7 | use OfflineAgency\MongoAutoSync\Traits\MainMongoTrait; |
||
| 8 | use OfflineAgency\MongoAutoSync\Traits\ModelAdditionalMethod; |
||
| 9 | use OfflineAgency\MongoAutoSync\Traits\PlainMongoTrait; |
||
| 10 | use OfflineAgency\MongoAutoSync\Traits\RelationshipMongoTrait; |
||
| 11 | |||
| 12 | class MDModel extends Eloquent |
||
| 13 | { |
||
| 14 | use MainMongoTrait, ModelAdditionalMethod, Helper, PlainMongoTrait, RelationshipMongoTrait; |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 15 | |||
| 16 | protected $connection = 'mongodb'; |
||
| 17 | protected $dates = [ |
||
| 18 | 'deleted_at', |
||
| 19 | 'created_at', |
||
| 20 | 'updated_at', |
||
| 21 | ]; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @return mixed |
||
| 25 | */ |
||
| 26 | public function getId() |
||
| 27 | { |
||
| 28 | return $this->id; |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @return string |
||
| 33 | */ |
||
| 34 | public function getCollection() |
||
| 35 | { |
||
| 36 | return $this->collection; |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @param int $size |
||
| 41 | * @return mixed |
||
| 42 | */ |
||
| 43 | public function getRandom($size = 3) |
||
| 44 | { |
||
| 45 | return $this->all()->random($size); |
||
| 46 | } |
||
| 47 | } |
||
| 48 |