1 | initial version |
To exhibit information gathered from a database using Laravel, here are the steps you can follow:
php artisan make:controller DataController
public function index(){
$data = DB::table('table_name')->get();
return view('data', compact('data'));
}
@extends('layouts.app')
@section('content')
<div class="container">
<table class="table table-bordered">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
</tr>
</thead>
<tbody>
@foreach($data as $row)
<tr>
<td>{{ $row->id }}</td>
<td>{{ $row->name }}</td>
<td>{{ $row->email }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection
Route::get('/data', 'DataController@index');
Note: This is just a basic example to exhibit information gathered from a database using Laravel. You can modify it as per your requirements. Additionally, ensure that the database configuration in the .env file is correct before getting started.