Laprak Modul 17
Laprak Modul 17
LAPORAN PRAKTIKUM
Laravel Factory & File Storage
oleh:
Ahmad Nunu Gustama (IS-06-02 – 1204230051)
<?php
namespace Database\Seeders;
use App\Models\Employee;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
// Variables
@import 'variables';
// Bootstrap
@import 'bootstrap/scss/bootstrap';
@import "bootstrap-icons/font/bootstrap-icons.css";
// Icons
@import "bootstrap-icons/font/bootstrap-icons.css";
// DataTables
@import "datatables.net-bs5/css/dataTables.bootstrap5.css";
@import "datatables.net-buttons-bs5/css/buttons.bootstrap5.css";
Import jQuery pada file /resources/js/bootstrap.js seperti yang terlihat di bawah ini.
import 'bootstrap';
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>{{ $pageTitle }}</title>
@vite('resources/sass/app.scss')
</head>
<body>
@include('layouts.nav')
@yield('content')
@vite('resources/js/app.js')
@include('sweetalert::alert')
@stack('scripts')
</body>
</html>
Buka file view pada /resources/views/employee/index.blade.php kemudian
gunakan block blade directive push() untuk menambahkan kode program seperti di
bawah ini.
@extends('layouts.app')
@section('content')
<div class="container mt-4">
<div class="row mb-0">
<div class="col-lg-9 col-xl-6">
<h4 class="mb-3">{{ $pageTitle }}</h4>
</div>
<div class="col-lg-3 col-xl-6">
<ul class="list-inline mb-0 float-end">
<li class="list-inline-item"> <a href="{{
route('employees.exportExcel') }}" class="btn btn-outline-success">
<i class="bi bi-download me-1"></i> to Excel
</a> </li>
<li class="list-inline-item"> <a href="{{
route('employees.exportPdf') }}" class="btn btn-outline-danger"> <i
class="bi bi-download me-1"></i> to PDF </a> </li>
<li class="list-inline-item">|</li> {{-- <li
class="list-inline-item"> <a
href="{{ route('employees.create') }}"
class="btn btn-primary"> <i
class="bi bi-plus-circle me-1"></i> Create
Employee </a> </li> --}} <button type="button" class="btn btn-primary"
data-bs-toggle="modal" data-bs-target="#createEmployee">
<i class="bi bi-plus-circle me-
1"></i>Create Employee </button>
</ul>
</div>
</div>
<hr>
<div class="table-responsive border p-3 rounded-3">
<table class="table table-bordered table-hover table-striped
mb-0 bg-white datatable" id="employeeTable">
<thead>
<tr>
<th>ID</th>
<th>No.</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Age</th>
<th>Position</th>
<th></th>
</tr>
</thead>
</table>
</div>
</div>
@endsection
Berikan atribut id dengan nilai “employeeTable” pada elemen tag <table> seperti
kode program di bawah ini.
<table class="table table-bordered table-hover table-striped mb-0 bg-
white datatable" id="employeeTable">
Akses halaman Employee List via browser, jika berhasil akan muncul tampilan
DataTables untuk data employee.
@extends('layouts.app')
@section('content')
<div class="container mt-4">
<div class="row mb-0">
<div class="col-lg-9 col-xl-6">
<h4 class="mb-3">{{ $pageTitle }}</h4>
</div>
<div class="col-lg-3 col-xl-6">
<ul class="list-inline mb-0 float-end">
<li class="list-inline-item"> <a href="{{
route('employees.exportExcel') }}" class="btn btn-outline-success">
<i class="bi bi-download me-1"></i> to Excel
</a> </li>
<li class="list-inline-item"> <a href="{{
route('employees.exportPdf') }}" class="btn btn-outline-danger"> <i
class="bi bi-download me-1"></i> to PDF </a> </li>
<li class="list-inline-item">|</li> {{-- <li
class="list-inline-item"> <a
href="{{ route('employees.create') }}"
class="btn btn-primary"> <i
class="bi bi-plus-circle me-1"></i> Create
Employee </a> </li> --}} <button type="button" class="btn btn-primary"
data-bs-toggle="modal" data-bs-target="#createEmployee">
<i class="bi bi-plus-circle me-
1"></i>Create Employee </button>
</ul>
</div>
</div>
<hr>
<div class="table-responsive border p-3 rounded-3">
<table class="table table-bordered table-hover table-striped
mb-0 bg-white datatable" id="employeeTable">
<thead>
<tr>
<th>ID</th>
<th>No.</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Age</th>
<th>Position</th>
<th></th>
</tr>
</thead>
</table>
</div>
</div>
@endsection
Akses halaman Employee List via browser, jika berhasil akan muncul tampilan
DataTables untuk data employee dengan teknik server-side processing.
2. Penerapan Laravel Sweet Alert
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>{{ $pageTitle }}</title>
@vite('resources/sass/app.scss')
</head>
<body>
@include('layouts.nav')
@yield('content')
@vite('resources/js/app.js')
@include('sweetalert::alert')
@stack('scripts')
</body>
</html>
$validator = Validator::make($request->all(), [
'firstName' => 'required',
'lastName' => 'required',
'email' => 'required|email',
'age' => 'required|numeric',
], $messages);
if ($validator->fails()) {
return redirect()->back()->withErrors($validator)-
>withInput();
}
// Get File
$file = $request->file('cv');
if ($file != null) {
$originalFilename = $file->getClientOriginalName();
$encryptedFilename = $file->hashName();
// Store File
$file->store('public/files');
}
// ELOQUENT
$employee = new Employee;
$employee->firstname = $request->firstName;
$employee->lastname = $request->lastName;
$employee->email = $request->email;
$employee->age = $request->age;
$employee->position_id = $request->position;
if ($file != null) {
$employee->original_filename = $originalFilename;
$employee->encrypted_filename = $encryptedFilename;
}
$employee->save();
return redirect()->route('employees.index');
}
$validator = Validator::make($request->all(), [
'firstName' => 'required',
'lastName' => 'required',
'email' => 'required|email',
'age' => 'required|numeric',
], $messages);
if ($validator->fails()) {
return redirect()->back()->withErrors($validator)-
>withInput();
}
// ELOQUENT
$employee = Employee::find($id);
$employee->firstname = $request->firstName;
$employee->lastname = $request->lastName;
$employee->email = $request->email;
$employee->age = $request->age;
$employee->position_id = $request->position;
$file = $request->file('cv');
$originalFilename = $file->getClientOriginalName();
$encryptedFilename = $file->hashName();
$employee->original_filename = $originalFilename;
$employee->encrypted_filename = $encryptedFilename;
}
$employee->save();
return redirect()->route('employees.index');
}
return redirect()->route('employees.index');
}
@extends('layouts.app')
@section('content')
<div class="container mt-4">
<div class="row mb-0">
<div class="col-lg-9 col-xl-6">
<h4 class="mb-3">{{ $pageTitle }}</h4>
</div>
<div class="col-lg-3 col-xl-6">
<ul class="list-inline mb-0 float-end">
<li class="list-inline-item"> <a href="{{
route('employees.exportExcel') }}" class="btn btn-outline-success">
<i class="bi bi-download me-1"></i> to Excel
</a> </li>
<li class="list-inline-item"> <a href="{{
route('employees.exportPdf') }}" class="btn btn-outline-danger"> <i
class="bi bi-download me-1"></i> to PDF </a> </li>
<li class="list-inline-item">|</li> {{-- <li
class="list-inline-item"> <a
href="{{ route('employees.create') }}"
class="btn btn-primary"> <i
class="bi bi-plus-circle me-1"></i> Create
Employee </a> </li> --}} <button type="button" class="btn btn-primary"
data-bs-toggle="modal" data-bs-target="#createEmployee">
<i class="bi bi-plus-circle me-
1"></i>Create Employee </button>
</ul>
</div>
</div>
<hr>
<div class="table-responsive border p-3 rounded-3">
<table class="table table-bordered table-hover table-striped
mb-0 bg-white datatable" id="employeeTable">
<thead>
<tr>
<th>ID</th>
<th>No.</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Age</th>
<th>Position</th>
<th></th>
</tr>
</thead>
</table>
</div>
</div>
@endsection
// ELOQUENT
// $employees = Employee::all();
return view('employee.index', [
'pageTitle' => $pageTitle,
'positions' => $positions
]);
}
Akses Fitur Create, Edit dan Delete Employee via browser, jika berhasil akan
muncul tampilan popup window dari SweetAlert sebagai feedback sistem untuk
proses yang sedang dilakukan oleh user. Contoh tampilannya seperti gambar di
bawah ini
3. Penerapan Laravel Excel
Publish file konfigurasi dengan menjalankan command script seperti di bawah ini.
@extends('layouts.app')
@section('content')
<div class="container mt-4">
<div class="row mb-0">
<div class="col-lg-9 col-xl-6">
<h4 class="mb-3">{{ $pageTitle }}</h4>
</div>
<div class="col-lg-3 col-xl-6">
<ul class="list-inline mb-0 float-end">
<li class="list-inline-item"> <a href="{{
route('employees.exportExcel') }}" class="btn btn-outline-success">
<i class="bi bi-download me-1"></i> to Excel
</a> </li>
<li class="list-inline-item"> <a href="{{
route('employees.exportPdf') }}" class="btn btn-outline-danger"> <i
class="bi bi-download me-1"></i> to PDF </a> </li>
<li class="list-inline-item">|</li> {{-- <li
class="list-inline-item"> <a
href="{{ route('employees.create') }}"
class="btn btn-primary"> <i
class="bi bi-plus-circle me-1"></i> Create
Employee </a> </li> --}} <button type="button" class="btn btn-primary"
data-bs-toggle="modal" data-bs-target="#createEmployee">
<i class="bi bi-plus-circle me-
1"></i>Create Employee </button>
</ul>
</div>
</div>
<hr>
<div class="table-responsive border p-3 rounded-3">
<table class="table table-bordered table-hover table-striped
mb-0 bg-white datatable" id="employeeTable">
<thead>
<tr>
<th>ID</th>
<th>No.</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Age</th>
<th>Position</th>
<th></th>
</tr>
</thead>
</table>
</div>
</div>
@endsection
Buat file Export dengan nama EmployeesExport via Artisan seperti di bawah ini.
Diarahkan kepada model Employee.
<?php
namespace App\Exports;
use App\Models\Employee;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithStyles;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class EmployeesExport implements FromView, WithStyles, ShouldAutoSize
{
public function styles(Worksheet $sheet)
{
return [1 => ['font' => ['bold' => true]],];
}
public function view(): View
{
return view('employee.export_excel', ['employees' =>
Employee::all()]);
}
}
<table>
<thead>
<tr>
<th>No.</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Age</th>
<th>Position</th>
</tr>
</thead>
<tbody>
@foreach ($employees as $index => $employee)
<tr>
<td>{{ $index + 1 }}</td>
<td>{{ $employee->firstname }}</td>
<td>{{ $employee->lastname }}</td>
<td>{{ $employee->email }}</td>
<td>{{ $employee->age }}</td>
<td>{{ $employee->position->name }}</td>
</tr>
@endforeach
</tbody>
</table>
@extends('layouts.app')
@section('content')
<div class="container mt-4">
<div class="row mb-0">
<div class="col-lg-9 col-xl-6">
<h4 class="mb-3">{{ $pageTitle }}</h4>
</div>
<div class="col-lg-3 col-xl-6">
<ul class="list-inline mb-0 float-end">
<li class="list-inline-item"> <a href="{{
route('employees.exportExcel') }}" class="btn btn-outline-success">
<i class="bi bi-download me-1"></i> to Excel
</a> </li>
<li class="list-inline-item"> <a href="{{
route('employees.exportPdf') }}" class="btn btn-outline-danger"> <i
class="bi bi-download me-1"></i> to PDF </a> </li>
<li class="list-inline-item">|</li> {{-- <li
class="list-inline-item"> <a
href="{{ route('employees.create') }}"
class="btn btn-primary"> <i
class="bi bi-plus-circle me-1"></i> Create
Employee </a> </li> --}} <button type="button" class="btn btn-primary"
data-bs-toggle="modal" data-bs-target="#createEmployee">
<i class="bi bi-plus-circle me-
1"></i>Create Employee </button>
</ul>
</div>
</div>
<hr>
<div class="table-responsive border p-3 rounded-3">
<table class="table table-bordered table-hover table-striped
mb-0 bg-white datatable" id="employeeTable">
<thead>
<tr>
<th>ID</th>
<th>No.</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Age</th>
<th>Position</th>
<th></th>
</tr>
</thead>
</table>
</div>
</div>
@endsection
Route::get('/employees/export-pdf', [EmployeeController::class,
'exportPdf'])->name('employees.exportPdf');
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Employee List</title>
<style>
html {
font-size: 12px;
}
.table {
border-collapse: collapse !important;
width: 100%;
}
.table-bordered th,
.table-bordered td {
padding: 0.5rem;
border: 1px solid black !important;
}
</style>
</head>
<body>
<h1>Employee List</h1>
<table class="table table-bordered">
<thead>
<tr>
<th>No.</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Age</th>
<th>Position</th>
</tr>
</thead>
<tbody>
@foreach ($employees as $index => $employee)
<tr>
<td align="center">{{ $index + 1 }}</td>
<td>{{ $employee->firstname }}</td>
<td>{{ $employee->lastname }}</td>
<td>{{ $employee->email }}</td>
<td align="center">{{ $employee->age }}</td>
<td>{{ $employee->position->name }}</td>
</tr>
@endforeach
</tbody>
</table>
</body>
</html>
Akses halaman Employee List via browser, kemudian klik button “to PDF” untuk
meng-export data employee ke dalam bentuk file PDF.
5. Memindahkan dan Memisahkan Kode Javascript
Kita dapat memindahkan kode javascript yang ada pada file view kita dan kita
kelompokkan dengan file-file javascript pada project laravel kita.
Buat file employee.js pada direktori /resources/js/. Hapus blok kode yang ada pada
blade directive push() pada file /resources/views/index.blade.php dan pindahkan
kode javascript yang ada ke file employee.js. Kode program pada file
index.blade.php akan menjadi seperti di bawah ini.
@extends('layouts.app')
@section('content')
<div class="container mt-4">
<div class="row mb-0">
<div class="col-lg-9 col-xl-6">
<h4 class="mb-3">{{ $pageTitle }}</h4>
</div>
<div class="col-lg-3 col-xl-6">
<ul class="list-inline mb-0 float-end">
<li class="list-inline-item"> <a href="{{
route('employees.exportExcel') }}" class="btn btn-outline-success">
<i class="bi bi-download me-1"></i> to Excel
</a> </li>
<li class="list-inline-item"> <a href="{{
route('employees.exportPdf') }}" class="btn btn-outline-danger"> <i
class="bi bi-download me-1"></i> to PDF </a> </li>
<li class="list-inline-item">|</li> {{-- <li
class="list-inline-item"> <a
href="{{ route('employees.create') }}"
class="btn btn-primary"> <i
class="bi bi-plus-circle me-1"></i> Create
Employee </a> </li> --}} <button type="button" class="btn btn-primary"
data-bs-toggle="modal" data-bs-target="#createEmployee">
<i class="bi bi-plus-circle me-
1"></i>Create Employee </button>
</ul>
</div>
</div>
<hr>
<div class="table-responsive border p-3 rounded-3">
<table class="table table-bordered table-hover table-striped
mb-0 bg-white datatable" id="employeeTable">
<thead>
<tr>
<th>ID</th>
<th>No.</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Age</th>
<th>Position</th>
<th></th>
</tr>
</thead>
</table>
</div>
</div>
<div class="modal fade" id="createEmployee" tabindex="-1" aria-
labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<form action="{{ route('employees.store') }}" method="POST"
enctype="multipart/form-data">
@csrf <div class="modal-header">
<h5 class="modal-title"
id="exampleModalLabel">Tambah Karyawan</h5>
</div>
<div class="modal-body">
<div class="form-group">
<label for="firstName" class="form-label">First
Name</label>
<input class="form-control @error('firstName')
is-invalid @enderror" type="text"
name="firstName" id="firstName" value="{{
old('firstName') }}"
placeholder="Enter First Name">
@error('firstName')
<div class="text-danger">
<small>{{ $message }}</small>
</div>
@enderror
</div>
<div class="form-group">
<label for="lastName" class="form-label">Last
Name</label>
<input class="form-control @error('lastName') is-
invalid @enderror" type="text"
name="lastName" id="lastName" value="{{
old('lastName') }}" placeholder="Enter Last Name">
@error('lastName')
<div class="text-danger">
<small>{{ $message }}</small>
</div>
@enderror
</div>
<div class="form-group">
<label for="email" class="form-label">Email</label>
<input class="form-control @error('email') is-
invalid @enderror" type="text" name="email"
id="email" value="{{ old('email') }}"
placeholder="Enter Email">
@error('email')
<div class="text-danger">
<small>{{ $message }}</small>
</div>
@enderror
</div>
<div class="form-group">
<label for="age" class="form-label">Age</label>
<input class="form-control @error('age') is-invalid
@enderror" type="text" name="age"
id="age" value="{{ old('age') }}"
placeholder="Enter Age">
@error('age')
<div class="text-danger">
<small>{{ $message }}</small>
</div>
@enderror
</div>
<div class="col-md-12 mb-3">
<label for="position" class="form-
label">Position</label>
<select name="position" id="position" class="form-
select">
@foreach ($positions as $position)
<option value="{{ $position->id }}"
{{ old('position') == $position->id ?
'selected' : '' }}>
{{ $position->code.' - '.$position-
>name }}</option>
@endforeach
</select>
@error('position')
<div class="text-danger">
<small>{{ $message }}</small>
</div>
@enderror
</div>
<div class="col-md-12 mb-3">
<label for="cv" class="form-label">
Curriculum Vitae (CV)
</label>
<input type="file" class="form-control"
name="cv" id="cv">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary"
data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save
changes</button>
</div>
</form>
</div>
</div>
</div>
@endsection
Kode program pada file employee.js akan menjadi seperti di bawah ini.
$(function () {
$("#employeeTable").DataTable({
serverSide: true,
processing: true,
ajax: "/getEmployees",
columns: [
{ data: "id", name: "id", visible: false },
{ data: "DT_RowIndex", name: "DT_RowIndex", orderable:
false, searchable: false },
{ data: "firstname", name: "firstname" },
{ data: "lastname", name: "lastname" },
{ data: "email", name: "email" },
{ data: "age", name: "age" },
{ data: "position.name", name: "position.name" },
{ data: "actions", name: "actions", orderable: false,
searchable: false },
],
order: [[0, "desc"]],
lengthMenu: [
[10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"],
],
});
Swal.fire({
title: "Are you sure want to delete\n" + name + "?",
text: "You won't be able to revert this!",
icon: "warning",
showCancelButton: true,
confirmButtonClass: "bg-primary",
confirmButtonText: "Yes, delete it!",
}).then((result) => {
if (result.isConfirmed) {
form.submit();
}
});
});
});
import './bootstrap';
import 'datatables.net-bs5';
import 'datatables.net-buttons-bs5';
import './employee';
import.meta.glob(["../images/**"]);
Akses halaman Employee List via browser, jika berhasil seluruh fitur tetap
berjalan dengan baik.
Pilih Bar Chart (Bisa disesuaikan dengan kebutuhan) pada pilihan chart yang
muncul di terminal seperti gambar di bawah ini.
namespace App\Charts;
use App\Models\Position;
use ArielMejiaDev\LarapexCharts\LarapexChart;
class EmployeesChart
{
protected $chart;
// ELOQUENT
// $employees = Employee::all();
return view('employee.index', [
'pageTitle' => $pageTitle,
'positions' => $positions
]);
}
@extends('layouts.app')
@section('content')
@include('default')
<div class="p-6 m-20 bg-white rounded shadow">
{!! $chart->container() !!}
</div>
{{ $chart->script() }}
@endsection
Akses halaman Home via browser, jika berhasil akan muncul tampilan Bar
Chart untuk data employee
7. Penerapan Modal Pop Up
@extends('layouts.app')
@section('content')
<div class="container mt-4">
<div class="row mb-0">
<div class="col-lg-9 col-xl-6">
<h4 class="mb-3">{{ $pageTitle }}</h4>
</div>
<div class="col-lg-3 col-xl-6">
<ul class="list-inline mb-0 float-end">
<li class="list-inline-item"> <a href="{{
route('employees.exportExcel') }}" class="btn btn-outline-success">
<i class="bi bi-download me-1"></i> to Excel
</a> </li>
<li class="list-inline-item"> <a href="{{
route('employees.exportPdf') }}" class="btn btn-outline-danger"> <i
class="bi bi-download me-1"></i> to PDF </a> </li>
<li class="list-inline-item">|</li> {{-- <li
class="list-inline-item"> <a
href="{{ route('employees.create') }}"
class="btn btn-primary"> <i
class="bi bi-plus-circle me-1"></i> Create
Employee </a> </li> --}} <button type="button" class="btn btn-primary"
data-bs-toggle="modal" data-bs-target="#createEmployee">
<i class="bi bi-plus-circle me-
1"></i>Create Employee </button>
</ul>
</div>
</div>
<hr>
<div class="table-responsive border p-3 rounded-3">
<table class="table table-bordered table-hover table-striped
mb-0 bg-white datatable" id="employeeTable">
<thead>
<tr>
<th>ID</th>
<th>No.</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Age</th>
<th>Position</th>
<th></th>
</tr>
</thead>
</table>
</div>
</div>
@endsection
Masih tetap pada file yang sama, tambahkan kode program pada bagian
bawah sesuai pada kode program di bawah ini.
@extends('layouts.app')
@section('content')
<div class="container mt-4">
<div class="row mb-0">
<div class="col-lg-9 col-xl-6">
<h4 class="mb-3">{{ $pageTitle }}</h4>
</div>
<div class="col-lg-3 col-xl-6">
<ul class="list-inline mb-0 float-end">
<li class="list-inline-item"> <a href="{{
route('employees.exportExcel') }}" class="btn btn-outline-success">
<i class="bi bi-download me-1"></i> to Excel
</a> </li>
<li class="list-inline-item"> <a href="{{
route('employees.exportPdf') }}" class="btn btn-outline-danger"> <i
class="bi bi-download me-1"></i> to PDF </a> </li>
<li class="list-inline-item">|</li> {{-- <li
class="list-inline-item"> <a
href="{{ route('employees.create') }}"
class="btn btn-primary"> <i
class="bi bi-plus-circle me-1"></i> Create
Employee </a> </li> --}} <button type="button" class="btn btn-primary"
data-bs-toggle="modal" data-bs-target="#createEmployee">
<i class="bi bi-plus-circle me-
1"></i>Create Employee </button>
</ul>
</div>
</div>
<hr>
<div class="table-responsive border p-3 rounded-3">
<table class="table table-bordered table-hover table-striped
mb-0 bg-white datatable" id="employeeTable">
<thead>
<tr>
<th>ID</th>
<th>No.</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Age</th>
<th>Position</th>
<th></th>
</tr>
</thead>
</table>
</div>
</div>
@endsection
// ELOQUENT
// $employees = Employee::all();
return view('employee.index', [
'pageTitle' => $pageTitle,
'positions' => $positions
]);
}
Akses halaman Employee List via browser, lalu tekan tombol Create
Employee, jika berhasil akan muncul tampilan Pop Up Create employee
seperti pada gambar di bawah ini.
LINK GITHUB
https://github.com/ahmadnunu/Modul-17.git