There is nothing wrong with your MongoDB, I think you are declaring the local class variable in the wrong way.
Try to implement the following code:
<?php
use Jenssegers\Mongodb\Model as Eloquent;
class User extends Eloquent {
//protected $connection = 'mongodb';
protected $collection = 'users';
}
?>
And in the controller/UserController.php:
Do you want to be a full-stack developer? Enroll in this Full Stack Certification to get started with your journey.
class UserController extends \BaseController
{
public function all()
{
return User::all();
}
}
routes.php
route::get("all-users","UserController@all");