Bonjour,
J'ai cette erreur avec le package moloquent/moloquent.
composer require moloquent/moloquent
Ma classe Item est étendue de la classe Moloquent:
<?php
namespace App;
use Moloquent\Eloquent\Model as Eloquent;
class Item extends Eloquent
{
protected $collection = 'items';
protected $connection = 'mongodb';
...
}
Mon test pour insérer dans la collection items :
Item::create([
'user_id' => 1,
'title' => 'test',
'slug' => 'test',
])
Résultat :
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