Support the ongoing development of Laravel.io →
Configuration Database Eloquent
Last updated 2 years 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 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ottz0 ottz0 Joined 15 Nov 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.