Support the ongoing development of Laravel.io →
Configuration Database Eloquent
Last updated 3 months ago.
0

You're overriding your $query variable in destinationSearch method...

public static function destinationSearch(){

    $query = new ParentRegionList;
    $query = DB::connection($query->connection); // $query isn't ParentRegionList instance anymore...
    $query = DB::table($query->table)->where('RegionName', 'New York')->get(); // $query->table is null? And DB::connection has no effect anymore...

    $query = DB::getQueryLog();
    dd($query);
}

Probably, what you need is something like this:

public static function destinationSearch(){

    $parentRegionList = new ParentRegionList;
    $query = DB::connection($parentRegionList->connection)
                        ->table($parentRegionList->table)
                        ->where('RegionName', 'New York')
                        ->get();

    $log = DB::getQueryLog();
    dd($log);
}
Last updated 7 years ago.
0

Sign in to participate in this thread!

LaraJobs

Your banner here too?

ottz0 ottz0 ottz0 Joined 15 Nov 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.