Skip to content

Instantly share code, notes, and snippets.

@menuka94
Created December 10, 2016 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save menuka94/db3e70b5ae28df73ad5dc147dab7ea9d to your computer and use it in GitHub Desktop.
Save menuka94/db3e70b5ae28df73ad5dc147dab7ea9d to your computer and use it in GitHub Desktop.
Laravel - Display Table in HTML
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class StudentsController extends Controller{
public function getAllStudents(){
$all_students = ''; // fetch data from database
return view('table_view',[
'students' => $all_students
]);
}
}
@extend('layouts.master')
@section('title')
Table
@stop
@section('content')
<div class="row">
<div class="col-md-6">
<table class="table">
<tr>
<th>Name</th>
<th>Age</th>
<th>Gender</th>
<th>Date of Birth</th>
</tr>
@foreach($students as $student)
<tr>
<th>{{ $student->name }}</th>
<th>{{ $student->age }}</th>
<th>{{ $student->gender }}</th>
<th>{{ $student->dob }}</th>
</tr>
@endforeach
</table>
</div>
</div>
@stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment