Support the ongoing development of Laravel.io →
Database Eloquent

I have this error with moloquent/moloquent package.

composer require moloquent/moloquent

My Item class Model extended from Moloquent:

<?php

namespace App;

use Moloquent\Eloquent\Model as Eloquent;

class Item extends Eloquent
{
    protected $collection = 'items';
    protected $connection = 'mongodb';
...
}

My test to insert into items collection:

Item::create([
    'user_id' => 1,
    'title' => 'test',
    'slug' => 'test',
])

Result:

FatalThrowableError in Builder.php line 103: Type error: Argument 1 passed to Moloquent\Query\Builder::__construct() must be an instance of Moloquent\Connection, instance of Illuminate\Database\MySqlConnection given, called in /home/site_com/http/www/vendor/moloquent/moloquent/src/Eloquent/Model.php on line 560

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

pirmax pirmax Joined 18 Jul 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.