@@ -350,6 +350,40 @@ The belongsToMany relation will not use a pivot "table", but will push id's to a
Other relations are not yet supported, but may be added in the future. Read more about these relations on http://four.laravel.com/docs/eloquent#relationships
### MySQL Relations
If you're using a hybrid MongoDB and SQL setup, you're in luck! The model will automatically return a MongoDB- or SQL-relation based on the type of the related model. Of course, if you want this functionality to work both ways, your SQL-models will need to extend `Jenssegers\Eloquent\Model`. Note that this functionality only works for hasOne, hasMany and belongsTo relations.
Example SQL-based User model:
use Jenssegers\Eloquent\Model as Eloquent;
class User extends Eloquent {
protected $connection = 'mysql';
public function messages()
{
return $this->hasMany('Message');
}
}
And the Mongodb-based Message model:
use Jenssegers\Mongodb\Model as Eloquent;
class Message extends Eloquent {
protected $connection = 'mongodb';
public function user()
{
return $this->belongsTo('User');
}
}
### Raw Expressions
These expressions will be injected directly into the query.