EAS_PWEB


Arini Indah Nur Fuadah
05111740007003
PWEB C

1. Login aplikasi dengan user dan password
2. Mengisi formulir pendaftaran
3. Edit profil dan biodata calon pendaftar
4. Memilih sekolah tujuan yang dipilih
5. View formulir pendaftaran yang sudah permanen
6. Download formulir pendaftaran




1. .env


DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=rpl_blog
DB_USERNAME=root
DB_PASSWORD=

DB_DATABASE adalah nama database masing-masing

APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:TNuy/ndNpNl8gtJE0CBEmiK+Vmxq7r09Rff683O3bu0=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=rpl_blog
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

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}"
2. Migration
2014_10_12_000000_create_users_table.php
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
2018_11_23_054814_create_posts_table.php
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePostsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('nik');
            $table->integer('user_id')->unsigned()->index()->nullable();
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');  
            $table->text('nama');
            $table->text('ttl');
            $table->text('alamat');
            $table->text('jk');
            $table->text('agama');
            $table->text('sekolah');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('posts');
    }
}
3. Model
Post.php
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    //nama tabel model
    protected $table = 'posts';
    //semisal nama PK nya bukan id maka dia harus dituliskan 
    //protected $primaryKey = "id_post";

    //definisi kolom/properti di table post
    protected $fillable = ['nik','nama','ttl','alamat','jk','agama','sekolah','user_id'];

    public function User(){
        return $this->belongsTo('App\User');
    }
}
User.php
<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $table = 'users';
    protected $foreignKey = 'user_id';
    protected $fillable = [
        'name', 'email', 'password',
    ];

    public function Post(){
        return $this->hasMany('App\Post','user_id','id');
    }
    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];
}

4. Views
app.blade.php
<!DOCTYPE html>
<html lang="en">

  <head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>PPDB MOJOKERTO</title>

    <!-- Bootstrap core CSS -->
    
    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet">

    {{-- <link href="{{asset('vendor/bootstrap/css/bootstrap.css')}}" rel="stylesheet"> --}}
    {{-- <link href="{{ asset('css/business-casual.css')}}" rel="stylesheet"> --}}
    <link href="{{ asset('css/business-casual.min.css')}}" rel="stylesheet">
    <!-- Custom fonts for this template -->
    <link href="https://fonts.googleapis.com/css?family=Raleway:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Lora:400,400i,700,700i" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="css/business-casual.min.css" rel="stylesheet">

  </head>

  <body>
    <br>
    <br>
    <h1 class="site-heading text-center text-white d-none d-lg-block">
      <span class="site-heading-lower">P P D B - M O J O K E R T O</span>
      <span class="site-heading-upper text-primary mb-3">Pendaftaran peserta didik baru</span>
    </h1>

    <!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark py-lg-3 fixed-top" id="mainNav">
  <div class="container">
        <div class="collapse navbar-collapse" id="navbarResponsive">
          <ul class="navbar-nav">
            <li class="nav-item {{-- px-lg-1 --}}">
              <a class="nav-link text-uppercase text-expanded" href="{{url('/')}}">Home
                <span class="sr-only">(current)</span>
              </a>
            </li>
            @if(Auth::check())
            <li class="dropdown active">
              <a class="nav-link active text-expanded text-uppercase dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
              Daftar Sekolah
              </a>
            <div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
              <a class="dropdown-item text-expanded" href="{{url('/formulir')}}">Isi Formulir</a>
              <a class="dropdown-item text-expanded" href="{{url('/lihat')}}">Lihat Formulir</a>
            </div>
            </li>
            @endif
          </ul>
          <ul class="navbar-nav ml-auto">
                        <!-- Authentication Links -->
                        @guest
                            <li class="nav-item">
                                <a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
                            </li>
                            <li class="nav-item">
                                @if (Route::has('register'))
                                    <a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
                                @endif
                            </li>
                        @else
                            <li class="nav-item dropdown">
                                <a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
                                    {{ Auth::user()->name }} <span class="caret"></span>
                                </a>

                                <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
                                    <a class="dropdown-item" href="{{url('/profil')}}">Profil</a>
                                    <a class="dropdown-item" href="{{ route('logout') }}"
                                       onclick="event.preventDefault();
                                                     document.getElementById('logout-form').submit();">
                                        {{ __('Logout') }}
                                    </a>

                                    <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                        @csrf
                                    </form>
                                </div>
                            </li>
                        @endguest
                    </ul
        </div>
      </div>
</nav>

@yield('content')

    <br>
    <br>
    <footer class="footer text-faded text-center py-5">
      <div class="container">
        <p class="m-0 small">Copyright &copy; Your Website 2018</p>
      </div>
    </footer>

    <!-- Bootstrap core JavaScript -->
    <script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
    <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/0.9.0rc1/jspdf.min.js"></script>
    <script src="{{ asset('js/js.js')}}"></script>
  </body>

</html>
home.blade.php
@extends('layouts.app')

@section('content')
<section class="page-section">
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">Dashboard</div>

                <div class="card-body">
                    @if (session('status'))
                        <div class="alert alert-success" role="alert">
                            {{ session('status') }}
                        </div>
                    @endif

                    You are logged in!
                </div>
            </div>
        </div>
    </div>
</div>
</section>
@endsection
login.blade.php


@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">{{ __('Login') }}</div>

                <div class="card-body">
                    <form method="POST" action="{{ route('login') }}">
                        @csrf

                        <div class="form-group row">
                            <label for="email" class="col-sm-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>

                            <div class="col-md-6">
                                <input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" required autofocus>

                                @if ($errors->has('email'))
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $errors->first('email') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group row">
                            <label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>

                            <div class="col-md-6">
                                <input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" required>

                                @if ($errors->has('password'))
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group row">
                            <div class="col-md-6 offset-md-4">
                                <div class="form-check">
                                    <input class="form-check-input" type="checkbox" name="remember" id="remember" {{ old('remember') ? 'checked' : '' }}>

                                    <label class="form-check-label" for="remember">
                                        {{ __('Remember Me') }}
                                    </label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group row mb-0">
                            <div class="col-md-8 offset-md-4">
                                <button type="submit" class="btn btn-primary">
                                    {{ __('Login') }}
                                </button>

                                <a class="btn btn-link" href="{{ route('password.request') }}">
                                    {{ __('Forgot Your Password?') }}
                                </a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
register.blade.pgp
@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">{{ __('Register') }}</div>

                <div class="card-body">
                    <form method="POST" action="{{ route('register') }}">
                        @csrf

                        <div class="form-group row">
                            <label for="name" class="col-md-4 col-form-label text-md-right">{{ __('Name') }}</label>

                            <div class="col-md-6">
                                <input id="name" type="text" class="form-control{{ $errors->has('name') ? ' is-invalid' : '' }}" name="name" value="{{ old('name') }}" required autofocus>

                                @if ($errors->has('name'))
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $errors->first('name') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group row">
                            <label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>

                            <div class="col-md-6">
                                <input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" required>

                                @if ($errors->has('email'))
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $errors->first('email') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group row">
                            <label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>

                            <div class="col-md-6">
                                <input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" required>

                                @if ($errors->has('password'))
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group row">
                            <label for="password-confirm" class="col-md-4 col-form-label text-md-right">{{ __('Confirm Password') }}</label>

                            <div class="col-md-6">
                                <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
                            </div>
                        </div>

                        <div class="form-group row mb-0">
                            <div class="col-md-6 offset-md-4">
                                <button type="submit" class="btn btn-primary">
                                    {{ __('Register') }}
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
form.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
    @if (session('status'))
    <div class="alert alert-primary">
        {{ session('status') }}
    </div>
    @endif
<div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">{{ __('Pendaftaran') }}</div>

                <div class="card-body">
                    <form method="POST" action="{{url('/form')}}">
                        @csrf
                        <div class="form-group row">
                            <label class="col-md-4 col-form-label text-md-right">{{ __('NIK') }}</label>

                            <div class="col-md-6">
                                <input type="text" class="form-control" name="nik" required>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-md-4 col-form-label text-md-right">{{ __('Nama Panjang') }}</label>

                            <div class="col-md-6">
                                <input type="text" class="form-control" name="nama" required>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-md-4 col-form-label text-md-right">{{ __('TTL') }}</label>

                            <div class="col-md-6">
                                <input type="text" class="form-control" name="ttl" required>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Alamat') }}</label>

                            <div class="col-md-6">
                                <input type="text" class="form-control" name="alamat" required>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-md-4 col-form-label text-md-right">{{ __('Jenis Kelamin') }}</label>
                            <div class="col-md-6">
                                <select name="jk" id="jk" >
                                <option>Laki-laki</option>   
                                <option>Perempuan</option>  
                                </select> 
                         </div>
                         </div>
                        <div class="form-group row">   
                            <label class="col-md-4 col-form-label text-md-right">{{ __('Agama') }}</label>
                            <div class="col-md-6">  
                             <select name="agama" id="agama" >   
                             <option>Islam</option>   
                             <option>Kristen</option>
                             <option>Hindu</option>
                             <option>Budha</option>
                             <option>Kong Hu Chu</option>  
                          </select>   
                         </div>
                         </div> 
                        <div class="form-group row">
                            <label class="col-md-4 col-form-label text-md-right">{{ __('Pilih Sekolah') }}</label>
                            <div class="col-md-6">
                            <select name="sekolah" id="sekolah" >   
                             <option>SMP 1 Mojokerto</option>   
                             <option>SMP 2 Mojokerto</option>
                             <option>SMP 3 Mojokerto</option>
                             <option>SMP 4 Mojokerto</option>
                             <option>SMP 5 Mojokerto</option>  
                          </select>
                            </div>
                        </div>
                        <div class="form-group row mb-0">
                            <div class="col-md-6 offset-md-4">
                                <button type="submit" class="btn btn-primary">
                                    {{ __('Submit') }}
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
  </div>
@endsection
view.blade.php


@extends('layouts.app')
@section('content')
<section class="page-section cta">
<div class="container">
    <button class="btn" style="background-color: rgb(54,30,23); color: white;" id="cmd">Download PDF</button>
    <div class="card-body" id="content">
        <h4><strong>FORMULIR PENDAFTARAN</strong></h4>
        <br>
        <div class="bg-faded rounded p-5">
        <div class="form-group">
         <p><strong>NIK</strong></p>
         <p>{{$post->nik}}</p>
         <p><strong>NAMA</strong></p>
         <p>{{$post->nama}}</p>
         <p><strong>TTL</strong></p>
         <p>{{$post->ttl}}</p>
         <p><strong>ALAMAT</strong></p>
         <p>{{$post->alamat}}</p>
         <p><strong>Jenis Kelamin</strong></p>
         <p>{{$post->jk}}</p>
         <p><strong>AGAMA</strong></p>
         <p>{{$post->agama}}</p>
         <p><strong>SEKOLAH PILIHAN</strong></p>
         <p>{{$post->sekolah}}</p>
        </div>
    </div>
</div>
    <div id="editor"></div>
</div>
</section>
@endsection
  
5. Untuk Menghidupkan fungsi Donwload dengan hasil PDF

js.js

var doc = new jsPDF();
var specialElementHandlers = {
    '#editor': function (element, renderer) {
        return true;
    }
};

$('#cmd').click(function () {   
    doc.fromHTML($('#content').html(), 15, 15, {
        'width': 170,
            'elementHandlers': specialElementHandlers
    });
    doc.addImage($('#image'));
    doc.save('form_pendaftaran.pdf');
});
  • Tampilan Home
  • Register

  • Login
  • Setelah Login
  • Isi Form
  • Form
  • Edit Form

  • Hasil Form Permanen


  • Download




Komentar

Postingan populer dari blog ini

Bootstrap

Analisa Use Case

ETS APSI