@suhkha Did you install the mongodb PHP driver in your php.ini ?
Jan 26, 2017
22
Level 1
FatalThrowableError in Client.php line 81: Class 'MongoDB\Driver\Manager' not found
I have my laravel v.53 project with Homestead (before scotchbox). So in Homestead I install mongodb, so if I type:
mongodb --version
I got the version 3.2 so it's ok because I use the package jenssegers/laravel-mongodb First I'm not 100% sure if my config is correct:
database.php
'mongodb' => array(
'driver' => 'mongodb',
'host' => 'localhost',
'port' => 27017,
'username' => 'mongouser123',
'password' => 'secret',
'database' => 'stuff'
),
If I do in shell:
mongo -u mongouser123 -p secret 127.0.0.1/stuff
conection is successfully
so.. I have my own model and controller that I use with the package
CustomModel.php
namespace App;
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
use Illuminate\Database\Eloquent\Model;
class CustomModel extends Eloquent
{
protected $connection = 'mongodb';
protected $collection = 'things'; //stuff is the database
}
CustomModel.php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Code;
class CustomController extends Controller
{
public function index(){
$things = CustomModel::all();
return View::make('results-mongo',compact('things'));
}
}
And I have my route so, if I type the route in my browser to display the content of index() I got:
FatalThrowableError in Client.php line 81: Class 'MongoDB\Driver\Manager' not found
What's wrong? Or what's could be wrong? :'( Thank you!!!
Please or to participate in this conversation.