How to Join Multiple Tables in Laravel 8
Example How to Join Multiple Tables in Laravel 8:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
class JoinTableController extends Controller
{
function index()
{
$data = DB::table('city')
->join('state', 'state.state_id', '=', 'city.state_id')
->join('country', 'country.country_id', '=', 'state.country_id')
->select('country.country_name', 'state.state_name', 'city.city_name')
->get();
return view('join_table', compact('data'));
}
}
?>