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 AppHttpControllers; use IlluminateHttpRequest; use IlluminateSupportFacadesAuth; use IlluminateSupportFacadesDB; 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?
Advertisement
Answer
this should work for you:
$data = DB::table('SSL')->where('userID', Auth::id()) ->join('users', 'users.id', '=', 'SSL.userID'); ->get();