Skip to content

Commit e93b262

Browse files
unknownunknown
unknown
authored and
unknown
committed
test models added
1 parent aed212a commit e93b262

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

tests/models/Client.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
use Jenssegers\Mongodb\Model as Eloquent;
3+
4+
class Client extends Eloquent {
5+
6+
protected $collection = 'clients';
7+
8+
protected static $unguarded = true;
9+
10+
public function users()
11+
{
12+
return $this->belongsToMany('User');
13+
}
14+
}

tests/models/User.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@
77

88
class User extends Eloquent implements UserInterface, RemindableInterface {
99

10-
protected $collection = 'users';
10+
protected $collection = 'users';
1111

12-
protected $dates = array('birthday');
12+
protected static $unguarded = true;
1313

14-
protected static $unguarded = true;
15-
16-
public function books()
14+
public function books()
1715
{
1816
return $this->hasMany('Book', 'author_id');
1917
}
@@ -27,6 +25,11 @@ public function role()
2725
{
2826
return $this->hasOne('Role');
2927
}
28+
29+
public function clients()
30+
{
31+
return $this->belongsToMany('Client');
32+
}
3033

3134
/**
3235
* Get the unique identifier for the user.
@@ -58,4 +61,4 @@ public function getReminderEmail()
5861
return $this->email;
5962
}
6063

61-
}
64+
}

0 commit comments

Comments
 (0)