我是Mongo
和Laravel
的新手。我一直在关注this教程,当我在控制器中调用all
方法时,它给出了错误不支持的驱动程序[mongodb]
下面是我的控制器和型号
控制器:
class homeController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$users = \App\Homemodel::all();
$config_items = \App\Homemodel::getData();
echo "<pre>";
print_r($users);
}
模型
<?php
namespace App;
use Jenssegers\Mongodb\Model as Eloquent;
class Homemodel extends Eloquent
{
protected $connection = 'mongodb';
protected $collection = 'user';
public static function getData() {
echo "in all function";
}
}