I want to fetch data from more tables by running multiple queries. For example I want to fetch the education detail of a student just by click check box education. Similarly personal detail, publications detail by clicking check boxes for personal, publication.
How can I do this? My code is given here Controller code is ExampleController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
use Auth;
class ExampleController extends Controller
{
public function index()
{
$result = DB::table('education')->get();
$data = DB::table('publications')->get();
return view('triel',compact('result','data'));
}
}
and my view file is trail.blade.php and its code is given here. I have not defined the check boxes because I dont know how to retrieve data in check boxes.
@extends('layouts.app')
@section('content')
<div class="container"><br>
<h1>Irfan Khan Triel Page</h1>
<div class="text text-success text-center">
PHD Research
</div>
<table class="table">
<tr>
<th>
PHD Research Area
</th>
<th>University</th>
<th>Country</th>
</tr>
@foreach($result as $value)
<tr>
<td>{{$value->research_area}}</td>
<td>{{$value->univ}}</td>
<td>{{$value->country}}</td>
</tr>
@endforeach
</table>
<div class="text text-success text-center">
Publications Detail
</div>
<table class="table">
<tr>
<th>
Title
</th>
<th>Status</th>
<th>Year</th>
</tr>
@foreach($data as $value)
<tr>
<td>{{$value->title}}</td>
<td>{{$value->status}}</td>
<td>{{$value->year}}</td>
</tr>
@endforeach
</table>
@endsection
and the routes is given here.
Route::get('triel','ExampleController@index');
Here I want to show my data in view while checking publications detail or education details or both, but I dont know how to do this. Please help me any body. thanks in advance