mongodb / laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)
https://www.mongodb.com/docs/drivers/php/laravel-mongodb/
MIT License
7.01k stars 1.43k forks source link

What about Laravel 5.3 ? #927

Closed AliBahaari closed 6 years ago

AliBahaari commented 8 years ago

Hi ..., Recently Laravel 5.3 came out. Is there any problem If I use the version for Laravel 5.2 ?

lukepolo commented 8 years ago

Please use the search feature to find open issues #925

gp187 commented 8 years ago

As a workaround to use mongodb in laravel 5.3 you can use this

Model

use Jenssegers\Mongodb\Eloquent\Model as Moloquent;

class AdminUser extends Moloquent
{
    protected $connection="mongodb";
    protected $collection="admin_important_users";
}

Controller

class AdminUserController extends Controller
{
    public $model;

    public function __construct(AdminUser $user) {
        $this->model = $user;
    }
$col = $this->model->getConnection()->table('admin_important_users');
$col->get();

That's how you get collection object. I'll try some fixes but for now this works.

lukepolo commented 8 years ago

925 solves this , no need , just needs merged.

AliBahaari commented 8 years ago

Thanks @lukepolo & @gp187 ..., I didn't get what should I exactly ?

gp187 commented 8 years ago

Ok @lukepolo . Let's see it done. Merge please @jenssegers