When creating a query using the syntax DB::table(\'foo\'), it creates a generic class (stdClass). Is there any way to cast the resulting rows to a specific class?>
DB::table(\'foo\')
Yes. For example:
$query = DB::table('example_tbl')->where('id', $id)->get(); $cast = (array)$query; var_dump($cast);