Hi,
i got an error in a fresh installed laravel with mongodb.
I use the seeder looks like so:
`<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Faker\Factory as Faker;
use Illuminate\Support\Str;
//use Spatie\Permission\Models\Role;
use App\Models\User;
use App\Models\RoleHierarchy;
use Maklad\Permission\Models\Role;
use Maklad\Permission\Models\Permission;
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:331
327▕ // For select statements, we'll simply execute the query and return an array
328▕ // of the database result set. Each element in the array will be a single
329▕ // row from the database table, and will either be an array or objects.
330▕ $statement = $this->prepared(
➜ 331▕ $this->getPdoForSelect($useReadPdo)->prepare($query)
332▕ );
333▕
334▕ $this->bindValues($statement, $this->prepareBindings($bindings));
335▕
Hi, i got an error in a fresh installed laravel with mongodb. I use the seeder looks like so: `<?php namespace Database\Seeders; use Illuminate\Database\Seeder; use Illuminate\Support\Facades\DB; use Faker\Factory as Faker; use Illuminate\Support\Str; //use Spatie\Permission\Models\Role; use App\Models\User; use App\Models\RoleHierarchy; use Maklad\Permission\Models\Role; use Maklad\Permission\Models\Permission;
class UsersAndNotesSeeder extends Seeder { /**
@return void */ protected $connection = 'mongodb';
public function run() { $numberOfUsers = 10; $numberOfNotes = 5000; $usersIds = array(); $statusIds = array(); $userStatus = array( 'Active', 'Inactive', 'Pending', 'Banned' ); app()['cache']->forget('maklad.permission.cache');
} }
`
if i run this seeder i get this error:
`Error
Call to a member function prepare() on null
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:331 327▕ // For select statements, we'll simply execute the query and return an array 328▕ // of the database result set. Each element in the array will be a single 329▕ // row from the database table, and will either be an array or objects. 330▕ $statement = $this->prepared( ➜ 331▕ $this->getPdoForSelect($useReadPdo)->prepare($query) 332▕ ); 333▕ 334▕ $this->bindValues($statement, $this->prepareBindings($bindings)); 335▕
14 [internal]:0 App\Models\User::Maklad\Permission\Traits{closure}()
17 database/seeders/UsersAndNotesSeeder.php:76 App\Models\User::assignRole()`
the mongodb driver is installed and it works. the admin user is insert in the collection user. ANY Ideas? THX THomas