2 months ago

How to specify the database name in Jajra/ Datatables

Posted 2 months ago by RaduCruceana

I'm using Laravel 5 with Jajra/Datatables

The project use 3 databases, one is MySQL and 2 are commercial SQL databases.

The SQL databases have the tables with exactly same names.

If I want to display a table from MySql database I use in controller:

return  Datatables::of(DB::table('coeficientVR_VanzariNoi')
        ->get(['id','marca','model','capacitate','combustibil', 'caroserie', 'altaClasaSchimb', 'coeficient',

and it's working great!

How to specify a table from one of the the SQL databases?

I have models associated to them, and models have the connection specified.

Example for one of table which is named "version":

class version_Jato extends Model
    protected $connection = 'sqlJato';
    protected $table = 'version';
    protected $primaryKey = 'vehicle_id';


So I need to specify the SQL database but I don't know how.

Thank you for your time!

Please sign in or create an account to participate in this conversation.