I tried to use Capsule to create my own mysql database connection. I got a error message from Laravel:
Class paginator does not exist
Then I added a line of code:
$capsule->getContainer()->bind('paginator', 'Illuminate\Pagination\Paginator');
Another error message was showed up:
Target [Illuminate\View\ViewFinderInterface] is not instantiable.
Here is the constructor:
use Illuminate\Database\Capsule\Manager as Capsule;
public function __construct($params){
$capsule = new Capsule;
$params = array_merge(static::$baseParams, $params);
$capsule->addConnection($params);
//$capsule->getContainer()->bind('paginator', 'Illuminate\Pagination\Paginator');
$this->db = $capsule->getConnection();
}
ps:
$this->db->table('table_name')->get() work!
$this->db->table('table_name')->paginate(4) doesn't work!
How to fix this? Thanks !