Reputation: 103
I'm trying to read 2 tables in my view. Now I am trying to join an other table like this in my sslcontroller.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
class sslController extends Controller
{
function SSL(){
$data = DB::table('SSL')->where('userID', Auth::id())->get();
join('users');
return view('SSL',['data'=>$data]);
}
}
Now I want to get data from the SSL table but also from the users table. How to do this?
Upvotes: 0
Views: 293
Reputation: 240
this should work for you:
$data = DB::table('SSL')->where('userID', Auth::id())
->join('users', 'users.id', '=', 'SSL.userID');
->get();
Upvotes: 3