agungsugiarto / codeigniter4-eloquent

The Illuminate Database package for CodeIgniter 4
MIT License
25 stars 8 forks source link

add ability to use non-"public" schema #3

Closed samsonasik closed 4 years ago

samsonasik commented 4 years ago

For postgres, it requires https://github.com/agungsugiarto/codeigniter4-eloquent/pull/2 to be merged first.

Step to reproduce:

<?php namespace App\Controllers;

use App\Models\Album;
use Fluent\Models\DB;

class Home extends BaseController
{
    public function index()
    {
        config('Database')->connect()->schema  = 'abcdef';

        service('eloquent');

        return $this->response->setJSON([
            'data'   => Album::all(),
            'sample' => DB::table('album')->skip(1)->take(100)->get(),
        ]);
    }
}