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);
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community