Im not the best in laravel but i try my best in converting sql to laravel syntax. My Problem is that i cant get an output with the inner join query i wrote.
My Query:
$scores = DB::table('users')
->join('devices', 'devices.id', '=', 'users.id')
->select('devices.id', 'devices.devicename', 'users.name as ausgeliehen von', 'devices.created_at', 'devices.updated_at')
->get();
My View:
<tbody>
@foreach ($scores as $score)
<tr>
<td>{{ ++$i }}</td>
<td>{{ $score->devicename}}</td>
<td>{{ $score->name }}</td>
<td>{{ $score->created_at }}</td>
<td>{{ $score->updated_at }}</td>
My Output table looks like this:
Sql query:
SELECT devices.id, devices.devicename,users.name, devices.created_at, devices.updated_at
FROM devices
INNER JOIN users ON devices.id = users.id;
Output from sql query: