LAMPIRAN-LAMPIRAN A. Source Code 1) Sample Controller pada HomeController.php

Similar documents
LAMPIRAN. Index.php. <?php. unset($_session["status"]); //session_destroy(); //session_destroy();

Building beautiful websites with Bootstrap: A case study. by Michael Kennedy michaelckennedy.net

TUTORIAL CRUD CODEIGNITER

Working Bootstrap Contact form with PHP and AJAX

Enhancing Koha s Public Reports Feature

Bootstrap 1/20

For instructions to change the logo, please refer to:

Create First Web Page With Bootstrap

CSS (Cascading Style Sheets)

Lampiran. SetoransController

This project will use an API from to retrieve a list of movie posters to display on screen.

For instructions to change the logo, please refer to: ore

NukaCode - Front End - Bootstrap Documentation

Project Part 2 (of 2) - Movie Poster And Actor! - Lookup

Description: This feature will enable user to send messages from website to phone number.

Pliki.tpl. scripts/flash_messages.tpl. scripts/panel/index.tpl. Dokumentacja zmian plików graficznych: rwd clickshop Wersja zmian:

For instructions to change the logo, please refer to: ore

Dingle Coderdojo 6. Project Part 2 (of 2) - Movie Poster And Actor! - Lookup. Week 6

Pliki.tpl. scripts/flash_messages.tpl. scripts/panel/index.tpl. Dokumentacja zmian plików graficznych: rwd shoper Wersja zmian:

Codeigniter - CRUD dengan Angularjs

AngularJS. CRUD Application example with AngularJS and Rails 4. Slides By: Jonathan McCarthy

AngularJS. CRUD Application example with AngularJS and Rails 4. Slides By: Jonathan McCarthy

Release notes 3.3. silver.solutions GmbH Färberstr Berlin. Telefon:

Lampiran Source Code:

LAMPIRAN. Universitas Sumatera Utara

HTML, CSS, Bootstrap, Javascript and jquery

INTRODUCTION TO WEB DEVELOPMENT IN C++ WITH WT 4

Chapter6: Bootstrap 3. Asst.Prof.Dr. Supakit Nootyaskool Information Technology, KMITL

Pliki.tpl. boxes/languagelist/box.tpl. boxes/newsletter/box.tpl. scripts/basket/address.tpl

Spring Data JPA, Spring Boot, Oracle, AngulerJS 적용게시판실습 게시판리스트보기.

For instructions to change the logo, please refer to: ore

ToDoList. 1.2 * allow custom user list to be passed in * publish changes to a channel ***/

CSS (Cascading Style Sheets): An Overview

User manual Scilab Cloud API

For instructions to change the logo, please refer to:

А «- - «Exellent»» 50, 18, «Exellent»., , -., -. -,, html -. - «Exellent»,.

Summary 4/5. (contains info about the html)

GROUPER EVALUATION & REMEDIATION REPORT

Custom T-Shirt Designs

1.2 * allow custom user list to be passed in * publish changes to a channel

django-session-security Documentation

How to use the MVC pattern to organize your code

Corinne Dmitruk James Saporito. Term Project documentation. The home page ViewBag.Title = "WelpHome"; }

HTML: Fragments, Frames, and Forms. Overview

Session 5. Web Page Generation. Reading & Reference

A WEB BASED APPLICATION DESIGN FOR PRODUCT DATA ENGINEERING AND MANAGEMENT

MUSE Web Style Guide DRAFT v3

Django AdminLTE 2 Documentation

CPET 499/ITC 250 Web Systems. Topics

Ten good practices for ASP.NET MVC applications

Guide to Integrate. ADSelfService Plus with. Outlook Web App.

26 $host = "localhost" ; 27 $user = "marcolg" ; 28 $password = "" ; 52 $connessione = new mysqli ($host, $user, $password );

Lampiran. Lampiran 1 : Database

JavaScript CSCI 201 Principles of Software Development

Hyperlinks, Tables, Forms and Frameworks

Mobile Design for the Future That is Here Already. Rick Ells UW Information Technology University of Washington

A database-driven web site

FatModel Quick Start Guide

Laravel 5 Cookbook. Enhance Your Amazing Applications. Nathan Wu Nathan Wu

User manual Scilab Cloud API

1.1 Text Alternatives: Provide text alternatives for any non-text content. Web Accessibility Checker atutor.ca/achecker

,, : / ,.,,,,, : -, :, -, -, -, -,,, :, Microsoft Office PowerPoint «_05_»

Front End Programming in Designing Responsive Web Application for Imagine Cup

Major Project Report PRESENTED BY. Banani Das. Roll Number: Labani Basak. Roll Number: Under the supervision of

Mastering the APEX Universal Theme

CPSC 481: CREATIVE INQUIRY TO WSBF

ADDING INPUTS FORM FACTORY V2

CSE 154 LECTURE 8: FORMS

HTML TAG SUMMARY HTML REFERENCE 18 TAG/ATTRIBUTE DESCRIPTION PAGE REFERENCES TAG/ATTRIBUTE DESCRIPTION PAGE REFERENCES MOST TAGS

Where s My Cat? <title>where's My Cat?</title> </head> <body> <h1 class="where">where's MY CAT?</h1>

If Only. More SQL and PHP

,.., «..»

Front-End UI: Bootstrap

Lecture 7. Action View, Bootstrap & Deploying 1 / 40

Chapter4: HTML Table and Script page, HTML5 new forms. Asst. Prof. Dr. Supakit Nootyaskool Information Technology, KMITL

APACHE SLING & FRIENDS TECH MEETUP BERLIN, SEPTEMBER Hypermedia API Tools for Sling (HApi) Andrei Dulvac, Adobe

MYFATOORAH. Magento 1.8 & 1.9. Othman Hussein.

PrintShop Mail Web. Web Integration Guide

Input multiple field form menggunakan codeigniter + validasi dan Jquery

Lampiran 1: Struktur Organisasi PT. Argo Manunggal Triasta

Clojure Web Security. FrOSCon Joy Clark & Simon Kölsch

Paythru Remote Fields

<td style="text-align:center;">'.$no.'</td> <a href="'.$link_update.'&id='.$h['id_diagnosa'].'&action=edit" class="btn btn-xs btn-default">edit</a>

django-amp-tools Documentation Release latest

LAMPIRAN PROGRAM. <!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]--> <!--[if IE 7 ]><html class="ie ie7" lang="en"> <!

Accessibility Building Accessible Apps. Klara Schmitt

UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2016 EXAMINATIONS. CSC309H1 S Programming on the Web Instructor: Ahmed Shah Mashiyat

P - 13 Bab 10 : PHP MySQL Lanjut (Studi Kasus)

aint framework Documentation

Responsive Web Design and Bootstrap MIS Konstantin Bauman. Department of MIS Fox School of Business Temple University

Using Visual Studio 2017

CHAPTER 2 MARKUP LANGUAGES: XHTML 1.0

PROJECT ON EMPLOYEE DATABASE AND PAYROLL MANAGEMENT SYSTEM

Laravel. View, Forms, Input, Validation, Authentication Layer. Web Technologies II. Darja Solodovnikova. Adopted from Artūrs Lavrenovs

[PDF] PHP MYSQL SCHOOL MANAGEMENT SYSTEM

To con#nue using your mailbox, you need to upgrade and verify your mailbox. The service is free.

Integrated Dashboard Design

SilkTest 2009 R2. Rules for Object Recognition

Making a live edit contact list with Coldbox REST & Vue.js

CSC Web Technologies, Spring HTML Review

Transcription:

67 LAMPIRAN-LAMPIRAN A. Source Code 1) Sample Controller pada HomeController.php <?php namespace App\Http\Controllers; use App\Paket; use App\User; use App\Pesan; use App\About; use Carbon\Carbon; use PDF; use Auth; use Image; use Illuminate\Http\Request; class AdminController extends Controller public function construct() $this->middleware('super_admin'); Show the application dashboard. @return \Illuminate\Http\Response / public function admin() $user = Auth::user(); return view('admin.index', compact('user')); public function index() $pakets = Paket::all(); return view('admin.listpaket', compact('pakets')); Show the form for creating a new resource. @return \Illuminate\Http\Response / public function create() return view('admin.createpaket'); Store a newly created resource in storage. @param \Illuminate\Http\Request $request @return \Illuminate\Http\Response / public function store(request $request) $this->validate($request, [ 'nama_barang' => 'required',

68 ]); 'harga' => 'required', 'warna' => 'required', 'gambar' => 'required', $paket = new Paket; $paket->nama_barang = $request->nama_barang; $paket->harga = $request->harga; $paket->warna = $request->warna; if($request->hasfile('gambar')) $gambar = $request->file('gambar'); $filename = time().'.'.$gambar- >getclientoriginalextension(); Image::make($gambar)->resize(300,300)->save( public_path('/uploads/gambars/'.$filename )); $paket->gambar = $filename; $paket->save(); return redirect('paket')->with('message', 'Data sudah diinputkan'); Display the specified resource. @param int $id @return \Illuminate\Http\Response / public function show($id_paket) $paket = paket::where('id_paket',$id_paket)->first(); if(!$paket) return redirect('/paket'); return view('admin.singlepaket')->with('paket',$paket); Show the form for editing the specified resource. @param int $id @return \Illuminate\Http\Response / public function edit($id_paket) $paket = Paket::where('id_paket',$id_paket)->first(); if(!$paket) return redirect('/paket'); return view('admin.editpaket', compact('paket')); Update the specified resource in storage. @param \Illuminate\Http\Request $request @param int $id @return \Illuminate\Http\Response

69 / public function update(request $request, $id_paket) $this->validate($request, [ 'nama_barang' => 'required', 'harga' => 'required', 'warna' => 'required', ]); $paket = paket::where('id_paket',$id_paket)->first(); $paket->nama_barang = $request->nama_barang; $paket->harga = $request->harga; $paket->warna = $request->warna; $paket->save(); return redirect('paket')->with('message', 'Data sudah diedit'); Remove the specified resource from storage. @param int $id @return \Illuminate\Http\Response / public function destroy($id_paket) $paket = Paket::where('id_paket',$id_paket); $paket->delete(); return redirect('paket')->with('message', 'Data has been deleted!'); public function confrim() $pesans = Pesan::groupBy('user_id') ->where('status','=',0) ->select(\db::raw('count()'), 'user_id') ->get(); return view('admin.confirm', compact('pesans')); public function tocourier($user_id) $user = User::where('id', $user_id)->first(); $pesans = Pesan::where('user_id','=',$user_id)- >where('status','=',0)->get(); $couriers = User::where('courier','=',1)->get(); return compact('pesans','couriers','user')); view('admin.tocourier', public function confirmcourier(request $request, $id) $this->validate($request, [ 'courier' => 'required', ]);

70 $pesans = Pesan::where('user_id','=',$id)- >where('status','=','0')->get(); foreach ($pesans as $pesan) $pesan->courier = $request->courier; $pesan->status = 1; $pesan->save(); return redirect('/confirm-to-courier')- >with('message','pesanan Sudah dikirim ke kurir'); public function masuk() $pesans = Pesan::groupBy('user_id') ->where('status','=',2) ->select(\db::raw('count()'), 'user_id') ->get(); return view('admin.masuk', compact('pesans')); public function aturmasuk($user_id) $user = User::where('id', $user_id)->first(); $pesans = Pesan::where('user_id','=',$user_id)- >where('status','=',2)->get(); return view('admin.aturmasuk', compact('pesans','user')); public function barangmasuk($id_pesan) $pesan = Pesan::where('id_pesan', $id_pesan)->first(); return view('admin.barang', compact('pesan')); public function confirmmasuk(request $request, $id_pesan) $pesan = Pesan::where('id_pesan', $id_pesan)->first(); $pesan->quantity = $request->quantity; $pesan->status = 3; $pesan->save(); return redirect('/pakaianmasuk/'.$pesan->user_id)- >with('message','pesanan Sudah Masuk Segera dicuci'); public function antar() $pesans = Pesan::groupBy('user_id') ->where('status','=',3) ->select(\db::raw('count()'), 'user_id') ->get(); return view('admin.antar', compact('pesans')); public function toantar($user_id) $user = User::where('id', $user_id)->first(); $pesans = Pesan::where('user_id','=',$user_id)- >where('status','=',3)->get();

71 $couriers = User::where('courier','=',1)->get(); return compact('pesans','user','couriers')); view('admin.toantar', public function antarcourier(request $request, $id) $this->validate($request, [ 'courier' => 'required', ]); $pesans = Pesan::where('user_id','=',$id)- >where('status','=','3')->get(); foreach ($pesans as $pesan) $pesan->courier = $request->courier; $pesan->status = 4; $pesan->save(); return redirect('/antar-to-courier')->with('message','pesanan Sudah dikirim ke kurir'); public function history() $pesans = Pesan::groupBy('user_id') ->where('status','!=',0) ->select(\db::raw('count()'), 'user_id') ->get(); return view('admin.history', compact('pesans')); public function historyshow($user_id) $user = User::where('id', $user_id)->first(); $pesans = Pesan::where('user_id','=',$user_id)- >where('status','!=',0)->get(); return view('admin.historyshow', compact('pesans','user')); public function getpdf($id, $date) $user = User::where('id', $id)->first(); $datenow = Carbon::now()->toDateString(); $pesans = Pesan::where('user_id','=',$id)- >where('updated_at',$date)->get(); $waktu = Pesan::where('user_id','=',$id)- >where('updated_at',$date)->first(); $jumlah = Pesan::where('user_id','=',$id)- >where('updated_at',$date)->sum('harga'); $about = About::where('id_about','=',1)->first(); //$pdf = PDF::loadView('pdf.pdf', compact('user','datenow','pesans','jumlah','about','waktu')); //return $pdf->download($id.'.pdf'); return view('pdf.pdf', compact('user','datenow','pesans','jumlah','about','waktu'));

72 public function cetak() $pesans = Pesan::where('status','=',4) ->orwhere('status','=',5) ->get(); return view('admin.print', compact('pesans')); public function about($id_about) $about = about::where('id_about',$id_about)->first(); return view('admin.about', compact('about')); public function saveabout(request $request, $id_about) $this->validate($request, [ 'about' => 'required', ]); $about = About::where('id_about',$id_about)->first(); $about->about = $request->about; $about->save(); return redirect('/about/'.$id_about)->with('message', 'About has been created!'); 2) Sample Model pada User.php <?php namespace App; use App\Pesan; use Illuminate\Notifications\Notifiable; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable use Notifiable; The attributes that are mass assignable. @var array / protected $fillable = [

73 'name', 'email', 'password','token','status', ]; The attributes that should be hidden for arrays. @var array / protected $hidden = [ 'password', 'remember_token', ]; public function issuperadmin() if($this->super_admin==1) return true; return false; public function iscourier() if($this->courier==1) return true; return false; public function isuser() if($this->user==1) return true;

74 return false; public function pesans() return $this->hasmany(pesan::class); 3) Sample View pada home.blade.php @section('content') <div class="container"> <div class="row"> <div class="col-md-10 col-md-offset-1"> @if(session::has('message')) <div class="alert alert-dismissible alert-success"> <button type="button" class="close" datadismiss="alert"> </button> Session::get('message') @if(session::has('peringatan')) <div class="alert alert-dismissible alert-danger"> <button type="button" class="close" datadismiss="alert"> </button> Session::get('peringatan') <div align="center"> <img src=" url('/img/logo.jpg') " class="imgresponsive" width="700px"> <br> <h4 align="center"><em>silahkan Pilih Jenis Paket Laundry yang anda pilih :</em></h4> <br> @foreach ($pakets as $paket)

75 <div class="col-md-3" data-toggle="modal" @foreach ($pesans as $pesan) @if($paket->nama_barang == $pesan->nama_barang) " data-target="#sudahpesan $paket->id_paket @endforeach data-target="# $paket->id_paket "> <div class="small-box bg- $paket->warna "> <div class="inner"> <h4> $paket->nama_barang </h4> <h4>rp. number_format($paket->harga) @if($paket->nama_barang == 'Kiloan') /Kg @foreach ($pesans as $pesan) @if($paket->nama_barang == $pesan->nama_barang) <strong>(qty : $pesan->quantity )</strong> @endforeach </h4> <img src=" url('public/uploads/gambars') / $paket->gambar " alt="" width="100"> <div class="icon"> <i class="fa fa-shopping-cart"></i> @endforeach <!-- Modal -->

76 @foreach ($pakets as $paket) <div class="modal fade" id=" $paket->id_paket " tabindex="-1" role="dialog" aria-labelledby="mymodallabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" arialabel="close"><span aria-hidden="true"> </span></button> <h4 class="modal-title" id="mymodallabel"> $paket- >nama_barang </h4> <div class="modal-body"> <form class="form-horizontal" role="form" method="post" action=" url('/home') "> csrf_field() <div class="form-group $errors->has('quantity')? ' haserror' : '' "> <label for="quantity" class="col-md-4 controllabel">quantity Pesan :</label> <div class="col-md-4 input-group"> <input id="quantity" type="text" class="formcontrol" name="quantity" value=" old('quantity') "> <div class="input-group-addon"> @if($paket->nama_barang == 'Kiloan') Kg @else Potong @if ($errors->has('quantity')) <span class="help-block"> </strong> </span> <strong> $errors->first('quantity')

77 <br> <label for="tanggal_jemput" class="col-md-4 controllabel">tanggal Penjemputan :</label> <div class="col-md-4 input-group"> <input type="date" name="tanggal_jemput" class="formcontrol"> @if ($errors->has('tanggal_jemput')) <span class="help-block"> </strong> <strong> $errors->first('tanggal_jemput') </span> <br> <label for="waktu" class="col-md-4 control-label">waktu Perkiraan Penjemputan :</label> <div class="col-md-4 input-group"> <input type="time" name="waktu" class="form-control"> <p><em>( Jam Kerja 07.30-15.00) </em></p> @if ($errors->has('waktu')) <span class="help-block"> </strong> <strong> </span> $errors->first('waktu') <input type="hidden" name="nama_barang" value=" $paket->nama_barang "> >harga "> <input type="hidden" name="harga" value=" $paket- <button type="button" class="btn btn-default" datadismiss="modal">close</button> <button type="submit" class="btn btn-primary pull-right"><i class="fa fa-shopping-cart"></i> Pesan</button>

78 </form> @endforeach @foreach ($pakets as $paket) <div class="modal fade" id="sudahpesan $paket->id_paket " tabindex="-1" role="dialog" aria-labelledby="mymodallabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" arialabel="close"><span aria-hidden="true"> </span></button> <h4 class="modal-title" id="mymodallabel">peringatan</h4> <div class="modal-body"> Sudah Dipesan!! <br> Untuk pembatalan pemesanan pada halaman <a href=" url('history') ">HISTORY</a> <div class="modal-footer"> <button type="button" class="btn btn-default" datadismiss="modal">close</button> @endforeach @endsection