I have a website with navigation bar (which is in main.blade.php). I have created a jQuery table but not in the blade view but as a simple .php. How can I set the content section to it and add it to the blade? Thanks!
Routes:
web.php
old(a simple page from the blade):
Route::get('/manageclasses', ['as' => 'manageclasses', 'uses' => 'UserView\AdminController@manageclasses']);
the new one(a simple page with table):
Route::get('/manageclasses',['as' => 'manageclasses',function(){
$manageclasa = App\Elevi::all();
return View::make('table')->with('manageclasa', $manageclasa);
}]);
My blade layout where I would like to add the table
@extends('layouts.master')
@extends('layouts.navbar')
@extends('layouts.sidebar')
@section('content')
<h3 class="white-text">Manage Page</h3>
@endsection
My new layout with the table
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Manage Clasa</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"></script>
<link rel="stylesheet" type="text/css" href="//ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css">
</head>
<body>
<h1>Elevi clasa</h1>
<table>
<thead>
<tr>
<th>Nume</th>
<th>Prenume</th>
</tr>
</thead>
<tbody>
<?php foreach ($manageclasa as $elev): ?>
<tr>
<td><?php echo $elev['nume'] ?></td>
<td><?php echo $elev['prenume'] ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<script>
$(function(){
$("table").dataTable();
});
</script>
</body>
</html>
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire