Call to a member function prepare() on null
Hi everybody,
I'm a newbie in laravel and mongodb field. I installed jenssegers/laravel-mongodb, configured .env like below:
DB_CONNECTION=mongodb
DB_HOST=127.0.0.1
DB_PORT=27017
DB_DATABASE=db
DB_USERNAME=root
DB_PASSWORD=123456a@
The app connected to db successfully, I can perform every action like inserting, updating...
I have created a new form to insert account to account collection, everything is okay but when creating document successfully and I redirect to index by this statement:
redirect()->route('login-get')->with('success', 'Inserted successfully');
It returned Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR) Call to a member function prepare() on null
This log triggered from that:
// For select statements, we'll simply execute the query and return an array
// of the database result set. Each element in the array will be a single
// row from the database table, and will either be an array or objects.
$statement = $this->prepared($this->getPdoForSelect($useReadPdo)
->prepare($query));
But when I remove with function like that **redirect()->route('login-get')**, it redirects without errors,
I have changed DB_CONNECTION to mysql and get no errors.
Somebody can help me, please? Thank all!!!
Make sure your model is extending Jenssegers\Mongodb\Eloquent\Model.