Listing Program
Listing Program
Listing Program
.env
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:QxiaQGCDmIVmjxM8oqjJDcB268rvukB4e89ZS6vrSzU=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=db_sevteen
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
Halaman Welcome
<!doctype html>
<head>
<meta charset="utf-8">
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600"
rel="stylesheet" type="text/css">
<style>
html, body {
background-image: url("img/bgpolos.jpg");
background-color: #fff;
color: #636b6f;
font-weight: 100;
height: 100vh;
margin: 0;
.full-height {
height: 100vh;
.flex-center {
align-items: center;
display: flex;
justify-content: center;
.position-ref {
position: relative;
.top-right {
position: absolute;
right: 10px;
top: 18px;
.content {
text-align: center;
.title {
font-size: 84px;
.links > a {
color: red ;
padding: 0 25px;
font-size: 24px;
font-weight: 600;
letter-spacing: .1rem;
text-decoration: none;
text-transform: uppercase;
.m-b-md {
margin-bottom: 30px;
</style>
</head>
<body>
@if (Route::has('login'))
@auth
@else
</div>
@endif
</style>
WELCOME to E-17
</div>
<!--<a href="https://laracasts.com">Beranda</a>
<a href="https://laravel-news.com">News</a>
<a href="https://forge.laravel.com">Forge</a>
<a href="https://github.com/laravel/laravel">GitHub</a>-->
</div>
</div>
</div>
</body>
</html>
Halaman Login
@extends('layouts.app')
@section('content')
<div class="container">
<div class="col-md-8">
<div class="card">
@csrf
<div class="col-md-6">
<input id="user_id" type="numeric" class="form-
control{{ $errors->has('user_id') ? ' is-invalid' : '' }}" name="user_id"
value="{{ old('user_id') }}" required autofocus>
@if ($errors->has('user_id'))
</span>
@endif
</div>
</div>
@if ($errors->has('password'))
</span>
@endif
</div>
</div>
<div class="form-check">
{{ __('Remember Me') }}
</label>
</div>
</div>
</div>
{{ __('Login') }}
</button>
</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
Login controller
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
*/
use AuthenticatesUsers;
/**
*
* @var string
*/
/**
* @return void
*/
$this->middleware('guest')->except('logout');
Halaman Home/Dashboard
@extends('layouts.app')
@section('content')
<div class="container">
<div class="col-md-8">
<div class="card">
@if (session('status'))
{{ session('status') }}
</div>
@endif
</div></center>
</div>
</div>
</div>
</div>
@endsection
Home Controller
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
/**
* @return void
*/
$this->middleware('auth');
/**
* @return \Illuminate\Http\Response
*/
return view('home');
Model User
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Notifiable;
/**
* @var array
*/
protected $fillable = [
];
/**
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
{
protected $guarded = [];
<?php
namespace App\Http\Middleware;
use Closure;
class IsAdmin
/**
* @return mixed
*/
return redirect()->guest('/');
<?php
namespace App\Http;
/**
* @var array
*/
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\TrustProxies::class,
];
/**
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
'throttle:60,1',
'bindings',
],
];
/**
* @var array
*/
protected $routeMiddleware = [
];
Controller
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
Routes (web.php)
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
| Here is where you can register web routes for your application. These
*/
Route::get('/', function () {
return view('welcome');
});
Route::prefix('admin')->middleware('auth')->group(function(){
//tendik
Route::get('tendik','TendikController@index');
Route::get('tendik/tambah','TendikController@tambah');
Route::post('tendik/simpan','TendikController@simpan');
Route::get('tendik/hapus/{id}', 'TendikController@hapus');
Route::get('tendik/edit/{id}','TendikController@edit');
Route::put('tendik/update/{id}','TendikController@update');
//siswa
Route::get('murid','MuridController@index');
Route::get('murid/tambah','MuridController@tambah');
Route::post('murid/simpan','MuridController@simpan');
Route::get('murid/hapus/{id}', 'MuridController@hapus');
Route::get('murid/edit/{id}','MuridController@edit');
Route::put('murid/update/{id}','MuridController@update');
//materi
Route::get('materi','MateriController@index');
Route::get('materi/tambah','MateriController@tambah');
Route::post('materi/simpan','MateriController@simpan');
Route::get('materi/hapus/{id}', 'MateriController@hapus');
Route::get('materi/edit/{id}','MateriController@edit');
Route::put('materi/update/{id}','MateriController@update');
//GURU//---------------------------------------------------------------------------------
Route::get('tendik1','Tendik1Controller@index');
Route::get('murid1','Murid1Controller@index');
Route::get('mapel1','Mapel1Controller@index');
Route::get('materi1','Materi1Controller@index');
Route::get('materi1/tambah','Materi1Controller@tambah');
Route::post('materi1/simpan','Materi1Controller@simpan');
Route::get('materi1/hapus/{id}', 'MateriController@hapus');
Route::get('materi1/edit/{id}','Materi1Controller@edit');
Route::put('materi1/update/{id}','Materi1Controller@update');
//MURID//---------------------------------------------------------------------------------
Route::get('tendik1','Tendik1Controller@index');
Route::get('murid1','Murid1Controller@index');
Route::get('mapel1','Mapel1Controller@index');
Route::get('materi2','Materi2Controller@index');
Route::get('materi2/download/{path}', 'Materi2Contoller@show');
});
Route::get('/beranda', 'BerandaController@fungsi1');
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Tampilan Layouts Dan Sekaligus Authentication Untuk User
(app.blade.php)
<!DOCTYPE html>
<style type="text/css"></style>
<head>
<meta charset="utf-8">
</head>
<body>
</style>
<div id="app">
<div class="container">
<th>WELCOME</th>
</a>
<span class="navbar-toggler-icon"></span>
</button>
@auth
@if (Auth::user()->admin == 0)
<li class="dropdown">
</a>
<li><a href="{{
url('admin/tendik/tambah') }}"><center>Tambah Guru</center></a></li>
</ul>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
role="button" style="color: black">
</a>
<li><a href="{{
url('admin/murid/tambah') }}"><center>Tambah Siswa</center></a></li>
</ul>
<li class="dropdown">
</a>
<li><a href="{{
url('admin/materi/tambah') }}"><center>Tambah Materi</center></a></li>
</ul>
</ul>
</li>
</ul>
@elseif (Auth::user()->admin == 2)
</ul>
@endif
@endauth
</ul>
@guest
<li class="nav-item">
</li>
<li class="nav-item">
<a class="nav-link"
href="{{ route('register') }}">{{ __('Register') }}</a>
</li> -->
@else
</a>
<div>
<a class="dropdown-menu" href="{{ route('logout') }}"
onclick="event.preventDefault();
document.getElementById('logout-
form').submit();"><center>
{{ __('Logout') }}</center>
</a>
@csrf
</form>
</div>
</li>
</ul>
@endguest
</ul>
</div>
</div>
</nav>
<main class="py-4">
@if(Session::has('pesan'))
</div>
@endif
@yield('content')
</main>
</div>
</body>
</html>
@extends('layouts.app')
@section('content')
<div class="container">
<div class="col-md-16">
<div class="card">
<div class="card-body">
<thead>
<tr>
<th><center>NO</center></th>
<th><center>NAMA</center></th>
<th><center>Jenis Kelamin</center></th>
<th><center>Mata Pelajaran</center></th>
<th><center>NIK</center></th>
<th><center>NIP</center></th>
<th><center>NUPT</center></th>
<th><center>JABATAN</center></th>
<th><center>STATUS</center></th>
<th><center>Tanggal Lahir</center></th>
</tr>
</thead>
<tbody>
<tr>
<td><center>
</td></center>
</tr>
@endforeach
</tbody>
</table>
{{ $tendiks->links() }}
</div>
</div>
</div>
</div>
</div>
@endsection
@extends('layouts.app')
@section('content')
<div class="container">
<div class="col-md-8">
<div class="card">
<div class="card-body">
<div class="form-group">
{{ Form::label('nama', 'NAMA') }}
{{ Form::text('nama',null,array('class'=>'form-
control','placeholder' => 'Masukkan Nama','autofocus')) }}
</div>
<div class="form-group">
<br>
</div>
<div class="form-group">
{{ Form::text('mapel',null,array('class'=>'form-
control','placeholder' => 'Mata Pelajaran','autofocus')) }}
</div>
<div class="form-group">
{{ Form::label('nik', 'Nik') }}
{{ Form::text('nik',null,array('class'=>'form-control','placeholder'
=> 'Masukkan Nik','autofocus')) }}
</div>
<div class="form-group">
{{ Form::label('nip', 'Nip') }}
{{ Form::text('nip',null,array('class'=>'form-control','placeholder'
=> 'Masukkan Nip','autofocus')) }}
</div>
<div class="form-group">
{{ Form::label('nupt', 'Nupt') }}
{{ Form::text('nupt',null,array('class'=>'form-
control','placeholder' => 'Masukkan Nupt','autofocus')) }}
</div>
<div class="form-group">
{{ Form::label('JABATAN', 'JABATAN') }}
</div>
<div class="form-group">
{{ Form::label('Status', 'Status') }}
{{ Form::select('status', array('PNS' => 'PNS',
</div>
<div class="form-group">
{{ Form::date('tgl_lahir',null,array('class'=>'form-
control','placeholder' => 'Tanggal Lahir','autofocus','rows'=>'3',)) }}
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
$data['tendiks'] = \App\Tendik::paginate(100);
$data['judul'] = "GURU";
return view('tendik_index',$data);
$data['action'] = 'TendikController@simpan';
$data['btn_submit'] = 'SIMPAN';
$data['method'] = "POST";
return view('tendik_form',$data);
$validasi = $this->validate($request,[
]);
$requestData = $request->all();
\App\Tendik::create($requestData);
$tendik = \App\Tendik::findOrFail($id);
$tendik->delete();
$data['tendik'] = \App\Tendik::findOrFail($id);
$data['method'] = "PUT";
$data['btn_submit'] = "UPDATE";
return view('tendik_form',$data);
$tendik = \App\Tendik::findOrFail($id);
$validasi = $this->validate($request,[
]);
$requestData = $request->all();
$tendik->update($requestData);
@extends('layouts.app')
@section('content')
<div class="container">
<div class="col-md-16">
<div class="card">
<div class="card-header">DATA {{ $judul }}</div>
<div class="card-body">
<thead>
<tr>
<th><center>NO</center></th>
<th><center>NAMA</center></th>
<th><center>JENIS KELAMIN</center></th>
<th><center>NIK</center></th>
<th><center>NISN</center></th>
<th><center>TINGKAT</center></th>
<th><center>JURUSAN</center></th>
<th><center>TANGGAL LAHIR</center></th>
<th><center>ORANG TUA</center></th>
</tr>
</thead>
<tbody>
<td><center>
</td></center>
</tr>
@endforeach
</tbody>
</table>
{{ $murids->links() }}
</div>
</div>
</div>
</div>
</div>
@endsection
@extends('layouts.app')
@section('content')
<div class="container">
<div class="col-md-8">
<div class="card">
<div class="card-header">MURID</div>
<div class="card-body">
{{{ Form::model($murid, array('action' => $action, 'files' => true,
'method' => $method)) }}}
<div class="form-group">
{{ Form::label('nama', 'NAMA') }}
{{ Form::text('nama',null,array('class'=>'form-
control','placeholder' => 'Masukkan Nama','autofocus')) }}
</div>
<div class="form-group">
<br>
</div>
<div class="form-group">
{{ Form::label('nik', 'Nik') }}
{{ Form::text('nik',null,array('class'=>'form-control','placeholder'
=> 'Masukkan Nik','autofocus')) }}
</div>
<div class="form-group">
{{ Form::label('nisn', 'Nisn') }}
{{ Form::text('nisn',null,array('class'=>'form-
control','placeholder' => 'Masukkan Nisn','autofocus')) }}
</div>
<div class="form-group">
{{ Form::label('TINGKAT', 'TINGKAT') }}
</div>
<div class="form-group">
{{ Form::label('JURUSAN', 'JURUSAN') }}
</div>
<div class="form-group">
{{ Form::date('tgl_lhr',null,array('class'=>'form-
control','placeholder' => 'Tanggal Lahir','autofocus','rows'=>'3',)) }}
</div>
<div class="form-group">
{{ Form::text('ortu',null,array('class'=>'form-
control','placeholder' => 'Masukkan Nama Orang Tua','autofocus')) }}
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
$data['murids'] = \App\Murid::paginate(100);
$data['judul'] = "Murid";
return view('murid_index',$data);
$data['action'] = 'MuridController@simpan';
$data['btn_submit'] = 'SIMPAN';
$data['method'] = "POST";
return view('murid_form',$data);
$validasi = $this->validate($request,[
]);
$requestData = $request->all();
\App\Murid::create($requestData);
$murid = \App\Murid::findOrFail($id);
$murid->delete();
$data['murid'] = \App\Murid::findOrFail($id);
$data['method'] = "PUT";
$data['btn_submit'] = "UPDATE";
return view('murid_form',$data);
$murid = \App\Murid::findOrFail($id);
$validasi = $this->validate($request,[
'nama' => 'required',
]);
$requestData = $request->all();
$murid->update($requestData);
@extends('layouts.app')
@section('content')
<div class="container">
<div class="col-md-16">
<div class="card">
<div class="card-header">DATA {{ $judul }}</div>
<div class="card-body">
<thead>
<tr>
<th><center>NO</center></th>
<th><center>NAMA</center></th>
</tr>
</thead>
<tbody>
<tr>
<td><center>
</td></center>
</tr>
@endforeach
</tbody>
</table>
{{ $materis->links() }}
</div>
</div>
</div>
</div>
</div>
@endsection
@extends('layouts.app')
@section('content')
<div class="container">
<div class="col-md-8">
<div class="card">
<div class="card-header">MATERI</div>
<div class="card-body">
<div class="form-group">
{{ Form::text('name',null,array('class'=>'form-
control','placeholder' => 'Masukkan Nama','autofocus')) }}
</div>
<div class="form-group">
</div>
<button type="submit" class="btn btn-
primary">{{ $btn_submit }}</button>
</div>
</div>
</div>
</div>
</div>
@endsection
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
$data['materis'] = \App\Materi::paginate(100);
$data['judul'] = "Materi";
return view('materi_index',$data);
$data['action'] = 'MateriController@simpan';
$data['btn_submit'] = 'SIMPAN';
$data['method'] = "POST";
return view('materi_form',$data);
$validasi = $this->validate($request,[
]);
$file_nama = $request->file('path')->store('public/file');
$requestData = $request->all();
$requestData['path'] = $file_nama;
\App\Materi::create($requestData);
$materi = \App\Materi::findOrFail($id);
$path = $materi->path;
@\Storage::delete($path);
$materi->delete();
$data['materi'] = \App\Materi::findOrFail($id);
$data['method'] = "PUT";
$data['btn_submit'] = "UPDATE";
$data['action'] = array('MateriController@update', $id);
return view('materi_form',$data);
$materi = \App\Materi::findOrFail($id);
$validasi = $this->validate($request,[
]);
$datafile = $materi->file;
@\Storage::delete($datafile);
$file_nama = $request->file('path')->store('public/file');
$requestData = $request->all();
$requestData['path'] = $file_nama;
$materi->update($requestData);