I'm new to Laravel and I'm building a project in which I've a database with different tables and I want to display the data of these tables when the user clicks on a button/link on the same section of the page/view.
For example: If user clicks on Customer button, the table 'Customer' data will be shown on the page. If user clicks on Logs button, the table 'Logs' data will be shown in place of Customer table data and same goes for other tables.
Do I've to make different views or can I do that on a single view (Dashboard)?
I'm using Laravel 5.4, if that helps.
Image to what I want:
https://i.stack.imgur.com/0V9kk.jpg
Routes
Route::get('/','FTAccessController@dashboard'); //main page
Route::post('newcustomer','FTAccessController@newcustomer'); //adding new customer
Route::post('newcall','FTAccessController@newlog'); //adding new call log
Route::post('newexpense','FTAccessController@newexpense'); //adding new expense
Route::get('/displaycustomer','FTAccessController@displaycustomer'); //new routes for different pages to show data (same goes for logs and expenses)
common.blade.php
//code for navabars
@yield('content')
dashboard.blade.php
@extends('common')
@section('content')
//code for 3 buttons
@yield('displaydata')
@endsection
customers.blade.php (Three files will be made for displaying different data and I don't want that)
@extends('dashboard')
@section('displaydata')
<table>
@foreach($allcustomer as $a)
<tr>
<td>{{$a->CustId}}</td>
<td>{{$a->Name}}</td>
<td>{{$a->Email}}</td>
<td>{{$a->Mobile}}</td>
<td>{{$a->House}}</td>
<td>{{$a->Street}}</td>
<td>{{$a->City}}</td>
<td>{{$a->State}}</td>
<td>{{$a->Country}}</td>
<td>{{$a->Pincode}}</td>
<td>{{$a->ServiceType}}</td>
<td>{{$a->TillDate}}</td>
</tr>
@endforeach
</table>
@endsection
Help?