Hello I'm trying to replicate this SQL code into Laravel qBuilder but I'm not getting the result I want in the collection:
select chars.name, class.name, specs.name
FROM characters as chars
JOIN charclasses as class
JOIN charspecs as specs
WHERE chars.class_id = class.id
AND chars.spec_id = specs.id
Then I tried this in Laravel:
$charData = DB::table('characters')
->select('characters.*', 'charclasses.name', 'charspecs.name')
->join('charclasses', 'characters.class_id', '=', 'charclasses.id')
->join('charspecs', 'characters.spec_id', '=', 'charspecs.id')
->orderBy('user_id', 'ASC')
->get();
dd($charData);
and the result is: