0% found this document useful (0 votes)
2 views8 pages

Laprak Modul 15

The document details a practical report on developing a web application using Laravel, focusing on authentication features. It includes code snippets for login functionality, user seeding, and navigation components. Additionally, it provides links to GitHub repositories for the practical and exercise modules related to the project.

Uploaded by

Ahmadnunu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views8 pages

Laprak Modul 15

The document details a practical report on developing a web application using Laravel, focusing on authentication features. It includes code snippets for login functionality, user seeding, and navigation components. Additionally, it provides links to GitHub repositories for the practical and exercise modules related to the project.

Uploaded by

Ahmadnunu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

PENGEMBANGAN APLIKASI WEBSITE

LAPORAN PRAKTIKUM
Laravel Authentication

oleh:
Ahmad Nunu Gustama (IS-06-02 – 1204230051)

PROGRAM STUDI SISTEM INFORMASI


FAKULTAS REKAYASA INDUSTRI

TELKOM UNIVERSITY SURABAYA


2024
 Praktikum

Sebelum kita melakukan php artisan ui bootstrap –auth tampilan


yang ada di pojok kanan atas bertulisakan “home” karena belum
ada proses authenticationya, jika sudah di lakukan maka akan
mucul seperti di gambar
 Latihan
Login.blade.php

<!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>Login</title>
@vite('resources/sass/app.scss')
</head>

<body style="background-color: #007bff;">


<div class="d-flex justify-content-center align-items-center vh-
100">
<div class="card p-4 text-center" style="width: 350px; border-
radius: 10px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);">
<div class="mb-4">
<i class="bi-hexagon-fill" style="color: #007bff;
font-size: 50px;"></i>
</div>
<h5 class="mb-4 text-uppercase font-weight-bold"
style="color: #333;">Employee Data Master</h5>
<form method="POST" action="{{ route('login') }}">
@csrf
<div class="form-group mb-3">
<input id="email" type="email" name="email"
class="form-control @error('email') is-invalid @enderror"
placeholder="Enter Your Email" value="{{ old('email') }}" required>
@error('email')
<span class="invalid-feedback"
role="alert"><strong>{{ $message }}</strong></span>
@enderror
</div>
<div class="form-group mb-4">
<input id="password" type="password"
name="password" class="form-control @error('password') is-invalid
@enderror" placeholder="Enter Your Password" required>
@error('password')
<span class="invalid-feedback"
role="alert"><strong>{{ $message }}</strong></span>
@enderror
</div>
<button type="submit" class="btn btn-primary w-
100">
<i class="bi bi-box-arrow-in-right"></i> Log In
</button>
</form>
</div>
</div>
</div>
</body>

</html>

UserSeeder.php

<?php
namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;

class UserSeeder extends Seeder


{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('users')->insert([
'name' => 'Administrator',
'email' => 'admin@admin',
'password' => Hash::make('adminadmin'),
'created_at' => now(),
'updated_at' => now(),
]);
}
}

Nav.blade.php

@php
$currentRouteName = Route::currentRouteName(); @endphp
<nav class="navbar navbar-expand-md navbar-dark bg-primary">
<div class="container">
<a href="{{ route('home') }}" class="navbar-brand mb-0 h1">
<i class="bi-hexagon-fill me-2"></i> Data Master
</a>
<button type="button" class="navbar-toggler" data-bs-
toggle="collapse" data-bs-target="#navbarSupportedContent">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse"
id="navbarSupportedContent">
<hr class="d-md-none text-white-50">
<ul class="navbar-nav flex-row flex-wrap">
<li class="nav-item col-2 col-md-auto">
<a href="{{ route('home') }}"
class="nav-link @if ($currentRouteName ==
'home') active @endif">Home</a>
</li>
<li class="nav-item col-2 col-md-auto">
<a href="{{ route('employees.index') }}"
class="nav-link @if ($currentRouteName ==
'employees.index') active @endif">Employee</a>
</li>
</ul>
<hr class="d-md-none text-white-50">
@guest
@if (Route::has('login'))
<a href="{{ route('login') }}" class="btn btn-
outline-light my-2 ms-md-auto">
<i class="bi-box-arrow-in-right me-1"></i>
Login
</a>
@endif

@if (Route::has('register'))
<a href="{{ route('register') }}" class="btn btn-
outline-light my-2 ms-md-2">
<i class="bi-person-plus me-1"></i> Register
</a>
@endif
@else
<div class="dropdown ms-md-auto">
<button class="btn btn-outline-light dropdown-
toggle" type="button" id="userMenu"
data-bs-toggle="dropdown" aria-
expanded="false">
<i class="bi-person-circle me-1"></i> {{
Auth::user()->name }}
</button>
<ul class="dropdown-menu dropdown-menu-end" aria-
labelledby="userMenu">
<li>
<a class="dropdown-item" href="{{
route('profile') }}">
<i class="bi-person-circle me-1"></i>
My Profile
</a>
</li>
<li>
<hr class="dropdown-divider">
</li>
<li>
<a class="dropdown-item text-danger"
href="#"
onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
<i class="bi-box-arrow-right me-1"></i>
Logout
</a>
</li>
</ul>
</div>
<form id="logout-form" action="{{ route('logout') }}"
method="POST" class="d-none">
@csrf
</form>
@endguest
</div>
</div>
</nav>
Menambah codingan untuk login, lalu untuk username dan password nya
di set di UserSeeder.php lalu di sambungkan dengan modul 14
sebelumnya, supaya dapat tersambung kita ubah web.php nya supaya
dapat ter route.

 Git Hub
Praktikum:
https://github.com/ahmadnunu/Praktikum-Modul-15.git
Latihan:
https://github.com/ahmadnunu/Latihan-Modul-15.git

You might also like