mardi 25 juillet 2017

How to create a CRUD controller for Laravel Backpack with a table on SQL server

Currently I have a project with two databases, one using MySQL locally and the other is on SQL server on a different server. When I try making a CRUD controller for a table in the MySQL database it works the way it's supposed to. However, when I try to create a CRUD controller for a table in SQL server, at first I was getting a 500 error and a blank white page (not even a Laravel error). After some digging I saw in the vendor folder vendor\backpack\crud\src\Crud.php when I try $this->crud->setFromDb();, that in the function getDbColumnTypes() it makes a connection to \DB::raw and doesn't specify the connection.

I tried replacing the default database select with \DB::connection("sqlsrv")->getSchemaBuilder()->select($this->model->getTable()), but that only gives the names. And it looks like in other places as well Backpack connects to \DB::raw().

Is there a simple way to create a CRUD controller for a table on SQL server or do I need to override each function that makes a connection to the database?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire