Commit 922680d7 authored by Alex Renoki's avatar Alex Renoki

Moved upgrading to the bottom.

parent 1460b114
......@@ -11,8 +11,6 @@ This package adds functionalities to the Eloquent model and Query builder for Mo
- [Laravel](#laravel)
- [Lumen](#lumen)
- [Non-Laravel projects](#non-laravel-projects)
- [Upgrading](#upgrading)
- [Upgrading from version 2 to 3](#upgrading-from-version-2-to-3)
- [Testing](#testing)
- [Configuration](#configuration)
- [Eloquent](#eloquent)
......@@ -39,6 +37,8 @@ This package adds functionalities to the Eloquent model and Query builder for Mo
- [Cross-Database Relationships](#cross-database-relationships)
- [Authentication](#authentication)
- [Queues](#queues)
- [Upgrading](#upgrading)
- [Upgrading from version 2 to 3](#upgrading-from-version-2-to-3)
Installation
------------
......@@ -100,46 +100,6 @@ $capsule->getDatabaseManager()->extend('mongodb', function($config, $name) {
});
```
Upgrading
---------
#### Upgrading from version 2 to 3
In this new major release which supports the new MongoDB PHP extension, we also moved the location of the Model class and replaced the MySQL model class with a trait.
Please change all `Jenssegers\Mongodb\Model` references to `Jenssegers\Mongodb\Eloquent\Model` either at the top of your model files or your registered alias.
```php
use Jenssegers\Mongodb\Eloquent\Model;
class User extends Model
{
//
}
```
If you are using hybrid relations, your MySQL classes should now extend the original Eloquent model class `Illuminate\Database\Eloquent\Model` instead of the removed `Jenssegers\Eloquent\Model`.
Instead use the new `Jenssegers\Mongodb\Eloquent\HybridRelations` trait. This should make things more clear as there is only one single model class in this package.
```php
use Jenssegers\Mongodb\Eloquent\HybridRelations;
class User extends Model
{
use HybridRelations;
protected $connection = 'mysql';
}
```
Embedded relations now return an `Illuminate\Database\Eloquent\Collection` rather than a custom Collection class. If you were using one of the special methods that were available, convert them to Collection operations.
```php
$books = $user->books()->sortBy('title')->get();
```
Testing
-------
......@@ -1104,3 +1064,43 @@ Last, add the service provider in `config/app.php`:
```php
Jenssegers\Mongodb\MongodbQueueServiceProvider::class,
```
Upgrading
---------
#### Upgrading from version 2 to 3
In this new major release which supports the new MongoDB PHP extension, we also moved the location of the Model class and replaced the MySQL model class with a trait.
Please change all `Jenssegers\Mongodb\Model` references to `Jenssegers\Mongodb\Eloquent\Model` either at the top of your model files or your registered alias.
```php
use Jenssegers\Mongodb\Eloquent\Model;
class User extends Model
{
//
}
```
If you are using hybrid relations, your MySQL classes should now extend the original Eloquent model class `Illuminate\Database\Eloquent\Model` instead of the removed `Jenssegers\Eloquent\Model`.
Instead use the new `Jenssegers\Mongodb\Eloquent\HybridRelations` trait. This should make things more clear as there is only one single model class in this package.
```php
use Jenssegers\Mongodb\Eloquent\HybridRelations;
class User extends Model
{
use HybridRelations;
protected $connection = 'mysql';
}
```
Embedded relations now return an `Illuminate\Database\Eloquent\Collection` rather than a custom Collection class. If you were using one of the special methods that were available, convert them to Collection operations.
```php
$books = $user->books()->sortBy('title')->get();
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment