memperbaiki project

parent e5c957f0
...@@ -3,7 +3,7 @@ APP_DEBUG=true ...@@ -3,7 +3,7 @@ APP_DEBUG=true
APP_KEY=lpJoh1v20uOafAuEsWT4y4DBda9fbMZx APP_KEY=lpJoh1v20uOafAuEsWT4y4DBda9fbMZx
DB_HOST=localhost DB_HOST=localhost
DB_DATABASE=foodbooking DB_DATABASE=db_order_pizza
DB_USERNAME=root DB_USERNAME=root
DB_PASSWORD= DB_PASSWORD=
......
This source diff could not be displayed because it is too large. You can view the blob instead.
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Session;
class Book extends Model
{
protected $fillable = ['title', 'author_id', 'amount', 'harga'];
public static function boot()
{
parent::boot();
self::updating(function($book)
{
if ($book->amount < $book->borrowed) {
Session::flash("flash_notification", [
"level"=>"danger",
"message"=>"Jumlah pesanan $book->title harus >= " . $book->borrowed
]);
return false;
}
});
self::deleting(function($book)
{
if ($book->borrowLogs()->count() > 0) {
Session::flash("flash_notification", [
"level"=>"danger",
"message"=>"Makanan $book->title sedang dipesan."
]);
return false;
}
});
}
public function author()
{
return $this->belongsTo('App\Author');
}
public function borrowLogs()
{
return $this->hasMany('App\BorrowLog');
}
public function getStockAttribute()
{
$borrowed = $this->borrowLogs()->borrowed()->count();
$stock = $this->amount - $borrowed;
return $stock;
}
public function getBorrowedAttribute()
{
return $this->borrowLogs()->borrowed()->count();
}
}
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class BorrowLog extends Model
{
protected $casts = ['is_returned' => 'boolean',];
protected $fillable = ['book_id', 'user_id', 'is_returned'];
public function book()
{
return $this->belongsTo('App\Book');
}
public function user()
{
return $this->belongsTo('App\User');
}
public function scopeReturned($query)
{
return $query->where('is_returned', 1);
}
public function scopeBorrowed($query)
{
return $query->where('is_returned', 0);
}
}
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Session;
class Food extends Model
{
protected $fillable = ['id', 'nama', 'type', 'harga'];
protected $table = 'food';
public static function boot()
{
parent::boot();
}
}
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use Yajra\Datatables\Html\Builder;
use Yajra\Datatables\Datatables;
use App\Book;
use Laratrust\LaratrustFacade as Laratrust;
class ChefController extends Controller
{
public function index(Request $request, Builder $htmlBuilder)
{
if ($request->ajax()) {
$books = Book::with('author');
return Datatables::of($books)
->addColumn('stock', function($book){
return $book->stock;
})
->addColumn('action', function($book){
if (Laratrust::hasRole('chef')) return '';
return '<a class="btn btn-xs btn-primary" href="'.route('guest.books.borrow', $book->id).'">Selesai</a>';
})->make(true);
}
$html = $htmlBuilder
->addColumn(['data' => 'title', 'name'=>'title', 'title'=>'Jenis Makanan'])
->addColumn(['data' => 'stock', 'name'=>'stock', 'title'=>'Stock', 'orderable'=>false, 'searchable'=>false])
->addColumn(['data' => 'harga', 'name'=>'harga', 'title'=>'harga'])
->addColumn(['data' => 'author.name', 'name'=>'author.name', 'title'=>'Pemesan'])
->addColumn(['data' => 'action', 'name'=>'action', 'title'=>'', 'orderable'=>false, 'searchable'=>false]);
return view('dashboard.chef')->with(compact('html'));
}
}
...@@ -3,53 +3,42 @@ namespace App\Http\Controllers; ...@@ -3,53 +3,42 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Yajra\Datatables\Html\Builder; use Yajra\Datatables\Html\Builder;
use Yajra\Datatables\Datatables; use Yajra\Datatables\Datatables;
use App\Book; use App\Food;
use App\Order;
use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\File;
use App\Http\Requests\StoreBookRequest; use App\Http\Requests\StoreFoodRequest;
use App\Http\Requests\UpdateBookRequest; use App\Http\Requests\UpdateFoodRequest;
use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Database\Eloquent\ModelNotFoundException;
use App\BorrowLog; use App\BorrowLog;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use App\Exceptions\BookException; use App\Exceptions\FoodException;
use PDF; use PDF;
class BooksController extends Controller class FoodController extends Controller
{ {
public function __construct()
{
$this->middleware('auth');
}
/** /**
* Display a listing of the resource. * Display a listing of the resource.
* *
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function index(Request $request, Builder $htmlBuilder) public function index(Request $request, Builder $htmlBuilder)
{ {
if ($request->ajax()) { if(Auth::user()->id=='1'){
$books = Book::with('author'); $order = Order::all();
return Datatables::of($books) return view('foods.index')->with(compact('order'));
->addColumn('stock', function($book){ }
return $book->stock; else if(Auth::user()->id>='1'){
}) $food = Food::all();
->addColumn('action', function($book){ return view('Manager.index')->with(compact('food'));
return view('datatable._action', [
'model' => $book,
'form_url' => route('books.destroy', $book->id),
'edit_url' => route('books.edit', $book->id),
'confirm_message' => 'Yakin ingin menghapus ' . $book->title . '?',
]);
})->make(true);
} }
$html = $htmlBuilder
->addColumn(['data' => 'title', 'name'=>'title', 'title'=>'Jenis Makanan'])
->addColumn(['data' => 'stock', 'name'=>'amount', 'title'=>'Stock'])
->addColumn(['data' => 'harga', 'name'=>'harga', 'title'=>'harga'])
->addColumn(['data' => 'author.name', 'name'=>'author.name', 'title'=>'chef'])
->addColumn(['data' => 'action', 'name'=>'action', 'title'=>'Action', 'orderable'=>false, 'searchable'=>false]);
return view('books.index')->with(compact('html'));
} }
/** /**
...@@ -59,7 +48,12 @@ return $book->stock; ...@@ -59,7 +48,12 @@ return $book->stock;
*/ */
public function create() public function create()
{ {
return view('books.create'); $food = Food::all();
return view('foods.create')->with(compact('food'));
}
public function lihat()
{
return view('foods.lihat');
} }
/** /**
...@@ -71,13 +65,13 @@ return $book->stock; ...@@ -71,13 +65,13 @@ return $book->stock;
public function borrow($id) public function borrow($id)
{ {
try { try {
$book = Book::findOrFail($id); $food = Food::findOrFail($id);
Auth::user()->borrow($book); Auth::user()->borrow($food);
Session::flash("flash_notification", [ Session::flash("flash_notification", [
"level"=>"success", "level"=>"success",
"message"=>"Berhasil memesan $book->title" "message"=>"Berhasil memesan $food->title"
]); ]);
} catch (BookException $e) { } catch (FoodException $e) {
Session::flash("flash_notification", [ Session::flash("flash_notification", [
"level" => "danger", "level" => "danger",
"message" => $e->getMessage() "message" => $e->getMessage()
...@@ -94,10 +88,10 @@ return $book->stock; ...@@ -94,10 +88,10 @@ return $book->stock;
public function store(StoreBookRequest $request) public function store(StoreFoodRequest $request)
{ {
$book = Book::create($request->except('cover')); $food = Food::create($request->except('cover'));
// isi field cover jika ada cover yang diupload // isi field cover jika ada cover yang diupload
if ($request->hasFile('cover')) { if ($request->hasFile('cover')) {
// Mengambil file yang diupload // Mengambil file yang diupload
...@@ -109,15 +103,15 @@ $filename = md5(time()) . '.' . $extension; ...@@ -109,15 +103,15 @@ $filename = md5(time()) . '.' . $extension;
// menyimpan cover ke folder public/img // menyimpan cover ke folder public/img
$destinationPath = public_path() . DIRECTORY_SEPARATOR . 'img'; $destinationPath = public_path() . DIRECTORY_SEPARATOR . 'img';
$uploaded_cover->move($destinationPath, $filename); $uploaded_cover->move($destinationPath, $filename);
// mengisi field cover di book dengan filename yang baru dibuat // mengisi field cover di food dengan filename yang baru dibuat
$book->cover = $filename; $food->cover = $filename;
$book->save(); $food->save();
} }
Session::flash("flash_notification", [ Session::flash("flash_notification", [
"level"=>"success", "level"=>"success",
"message"=>"Berhasil menyimpan $book->title" "message"=>"Berhasil menyimpan $food->title"
]); ]);
return redirect()->route('books.index'); return redirect()->route('foods.index');
} }
/** /**
...@@ -126,9 +120,9 @@ return redirect()->route('books.index'); ...@@ -126,9 +120,9 @@ return redirect()->route('books.index');
* @param int $id * @param int $id
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function show($id) public function show()
{ {
// return view('foods.lihat');
} }
/** /**
...@@ -139,8 +133,8 @@ return redirect()->route('books.index'); ...@@ -139,8 +133,8 @@ return redirect()->route('books.index');
*/ */
public function edit($id) public function edit($id)
{ {
$book = Book::find($id); $food = Food::find($id);
return view('books.edit')->with(compact('book')); return view('foods.edit')->with(compact('food'));
} }
...@@ -151,11 +145,11 @@ return view('books.edit')->with(compact('book')); ...@@ -151,11 +145,11 @@ return view('books.edit')->with(compact('book'));
* @param int $id * @param int $id
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function update(UpdateBookRequest $request, $id) public function update(UpdateFoodRequest $request, $id)
{ {
$book = Book::find($id); $food = Food::find($id);
if(!$book->update($request->all())) return redirect()->back(); if(!$food->update($request->all())) return redirect()->back();
if ($request->hasFile('cover')) { if ($request->hasFile('cover')) {
// menambil cover yang diupload berikut ekstensinya // menambil cover yang diupload berikut ekstensinya
$filename = null; $filename = null;
...@@ -167,10 +161,10 @@ $destinationPath = public_path() . DIRECTORY_SEPARATOR . 'img'; ...@@ -167,10 +161,10 @@ $destinationPath = public_path() . DIRECTORY_SEPARATOR . 'img';
// memindahkan file ke folder public/img // memindahkan file ke folder public/img
$uploaded_cover->move($destinationPath, $filename); $uploaded_cover->move($destinationPath, $filename);
// hapus cover lama, jika ada // hapus cover lama, jika ada
if ($book->cover) { if ($food->cover) {
$old_cover = $book->cover; $old_cover = $food->cover;
$filepath = public_path() . DIRECTORY_SEPARATOR . 'img' $filepath = public_path() . DIRECTORY_SEPARATOR . 'img'
. DIRECTORY_SEPARATOR . $book->cover; . DIRECTORY_SEPARATOR . $food->cover;
try { try {
File::delete($filepath); File::delete($filepath);
} catch (FileNotFoundException $e) { } catch (FileNotFoundException $e) {
...@@ -178,17 +172,17 @@ File::delete($filepath); ...@@ -178,17 +172,17 @@ File::delete($filepath);
} }
} }
// ganti field cover dengan cover yang baru // ganti field cover dengan cover yang baru
$book->cover = $filename; $food->cover = $filename;
$book->save(); $food->save();
} }
Session::flash("flash_notification", [ Session::flash("flash_notification", [
"level"=>"success", "level"=>"success",
"message"=>"Berhasil menyimpan $book->title" "message"=>"Berhasil menyimpan $food->title"
]); ]);
return redirect()->route('books.index'); return redirect()->route('foods.index');
} }
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
...@@ -198,18 +192,18 @@ return redirect()->route('books.index'); ...@@ -198,18 +192,18 @@ return redirect()->route('books.index');
*/ */
public function destroy(Request $request, $id) public function destroy(Request $request, $id)
{ {
$book = Book::find($id); $food = Food::find($id);
$cover = $book->cover; $cover = $food->cover;
if(!$book->delete()) return redirect()->back(); if(!$food->delete()) return redirect()->back();
// handle hapus buku via ajax // handle hapus buku via ajax
if ($request->ajax()) return response()->json(['id' => $id]); if ($request->ajax()) return response()->json(['id' => $id]);
// hapus cover lama, jika ada // hapus cover lama, jika ada
if ($cover) { if ($cover) {
$old_cover = $book->cover; $old_cover = $food->cover;
$filepath = public_path() . DIRECTORY_SEPARATOR . 'img' $filepath = public_path() . DIRECTORY_SEPARATOR . 'img'
. DIRECTORY_SEPARATOR . $book->cover; . DIRECTORY_SEPARATOR . $food->cover;
try { try {
File::delete($filepath); File::delete($filepath);
...@@ -223,13 +217,13 @@ return redirect()->route('books.index'); ...@@ -223,13 +217,13 @@ return redirect()->route('books.index');
"message"=>"daftar berhasil dihapus" "message"=>"daftar berhasil dihapus"
]); ]);
return redirect()->route('books.index'); return redirect()->route('foods.index');
} }
public function returnBack($book_id) public function returnBack($food_id)
{ {
$borrowLog = BorrowLog::where('user_id', Auth::user()->id) $borrowLog = BorrowLog::where('user_id', Auth::user()->id)
->where('book_id', $book_id) ->where('food_id', $food_id)
->where('is_returned', 0) ->where('is_returned', 0)
->first(); ->first();
...@@ -239,19 +233,19 @@ return redirect()->route('books.index'); ...@@ -239,19 +233,19 @@ return redirect()->route('books.index');
Session::flash("flash_notification", [ Session::flash("flash_notification", [
"level" => "success", "level" => "success",
"message" => "Berhasil mengembalikan " . $borrowLog->book->title "message" => "Berhasil mengembalikan " . $borrowLog->food->title
]); ]);
} }
return redirect('/home'); return redirect('/home');
} }
public function export() public function export()
{ {
return view('books.export'); return view('foods.export');
} }
public function exportPost(Request $request) public function exportPost(Request $request)
{ {
// validasi // validasi
$this->validate($request, [ $this->validate($request, [
...@@ -261,16 +255,16 @@ return redirect()->route('books.index'); ...@@ -261,16 +255,16 @@ return redirect()->route('books.index');
'author_id.required'=>'Anda belum registrasi. silahkan registrasi terlebih dahulu.' 'author_id.required'=>'Anda belum registrasi. silahkan registrasi terlebih dahulu.'
]); ]);
$books = Book::whereIn('id', $request->get('author_id'))->get(); $foods = Food::whereIn('id', $request->get('author_id'))->get();
$handler = 'export' . ucfirst($request->get('type')); $handler = 'export' . ucfirst($request->get('type'));
return $this->$handler($books); return $this->$handler($foods);
} }
private function exportPdf($books) private function exportPdf($foods)
{ {
$pdf = PDF::loadview('pdf.books', compact('books')); $pdf = PDF::loadview('pdf.foods', compact('foods'));
return $pdf->download('books.pdf'); return $pdf->download('foods.pdf');
} }
......
...@@ -22,14 +22,14 @@ return $book->stock; ...@@ -22,14 +22,14 @@ return $book->stock;
}) })
->addColumn('action', function($book){ ->addColumn('action', function($book){
if (Laratrust::hasRole('admin')) return ''; if (Laratrust::hasRole('admin')) return '';
return '<a class="btn btn-xs btn-primary" href="'.route('guest.books.borrow', $book->id).'">Pesan</a>'; return '<a class="btn btn-xs btn-primary" href="'.route('guest.foods.borrow', $book->id).'">Pesan</a>';
})->make(true); })->make(true);
} }
$html = $htmlBuilder $html = $htmlBuilder
->addColumn(['data' => 'title', 'name'=>'title', 'title'=>'Jenis Makanan']) ->addColumn(['data' => 'title', 'name'=>'title', 'title'=>'Jenis Makanan'])
->addColumn(['data' => 'stock', 'name'=>'stock', 'title'=>'Stock', 'orderable'=>false, 'searchable'=>false]) ->addColumn(['data' => 'stock', 'name'=>'stock', 'title'=>'Stock', 'orderable'=>false, 'searchable'=>false])
->addColumn(['data' => 'harga', 'name'=>'harga', 'title'=>'harga']) ->addColumn(['data' => 'harga', 'name'=>'harga', 'title'=>'harga'])
->addColumn(['data' => 'author.name', 'name'=>'author.name', 'title'=>'chef']) ->addColumn(['data' => 'author.name', 'name'=>'author.name', 'title'=>'Pemesan'])
->addColumn(['data' => 'action', 'name'=>'action', 'title'=>'', 'orderable'=>false, 'searchable'=>false]); ->addColumn(['data' => 'action', 'name'=>'action', 'title'=>'', 'orderable'=>false, 'searchable'=>false]);
return view('guest.index')->with(compact('html')); return view('guest.index')->with(compact('html'));
} }
......
<?php
namespace App\Http\Controllers;
use App\Verifikasi;
use Illuminate\Http\Request;
use Yajra\Datatables\Html\Builder;
use Yajra\Datatables\Datatables;
use App\Food;
use App\Order;
use App\Paid;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\DB;
use App\Http\Requests\StoreFoodRequest;
use App\Http\Requests\UpdateFoodRequest;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use App\BorrowLog;
use Illuminate\Support\Facades\Auth;
use App\Exceptions\FoodException;
use PDF;
class OrderController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request, Builder $htmlBuilder)
{
if(Auth::user()->id=='1'){
$food = Food::all();
return view('foods.index')->with(compact('food'));
}
else if(Auth::user()->id>='1'){
$food = Food::all();
return view('Manager.index')->with(compact('food'));
}
else
return 'error';
}
public function save(Request $request)
{
$id=$request->get('id_food');
$food = Food::findOrFail($id);
$order = new Order();
$order->id_food=$food->id;
$order->name=Auth::user()->name;
$order->status=0;
$order->jumlah=$request->get('jumlah');
$food->total_harga=$request->get('total_harga');
$order->alamat=$request->get('alamat');
$order->nomor_telepon=$request->get('nomor_telepon');
$order->save();
return view('Manager.lihat')->with(["food"=>$food,"order"=>$order]);
}
public function pesan($id)
{
$food = Food::findOrFail($id);
return view('Order.pesan')->with(["food"=>$food]);
}
public function verification($id)
{
$input=Order::find($id);
Verifikasi::create(['id_food'=>$input['id_food'],'name'=>$input['name'],'jumlah'=>$input['jumlah']]);
Order::find($id)->delete();
return redirect(url("/listFood"));
}
public function paid($id)
{
$input=Order::find($id);
Paid::create(['id_food'=>$input['id_food'],'name'=>$input['name'],'jumlah'=>$input['jumlah']]);
Order::find($id)->delete();
return redirect(url("/listFood"));
}
public function destroy($id)
{
$order = Order::findOrFail($id);
$order->delete();
return redirect("listFoodCostumer");
}
public function delete($id)
{
$food = Food::findOrFail($id);
$food->delete();
return redirect("createFood");
}
public function create(Request $request)
{
return view('foods.tambah');
}
public function simpan(Request $request)
{
$food = new Food();
$food->id=$request->get('id_food');
$food->name=$request->get('name');
$food->type=$request->get('type');
$food->harga=$request->get('harga');
$food->save();
return redirect("createFood");
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function lihat()
{
return view('foods.lihat');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function borrow($id)
{
try {
$food = Food::findOrFail($id);
Auth::user()->borrow($food);
Session::flash("flash_notification", [
"level"=>"success",
"message"=>"Berhasil memesan $food->title"
]);
} catch (FoodException $e) {
Session::flash("flash_notification", [
"level" => "danger",
"message" => $e->getMessage()
]);
} catch (ModelNotFoundException $e) {
Session::flash("flash_notification", [
"level" => "danger",
"message" => "Makanan tidak ditemukan."
]);
}
return redirect('/');
}
public function store(StoreFoodRequest $request)
{
$food = Food::create($request->except('cover'));
// isi field cover jika ada cover yang diupload
if ($request->hasFile('cover')) {
// Mengambil file yang diupload
$uploaded_cover = $request->file('cover');
// mengambil extension file
$extension = $uploaded_cover->getClientOriginalExtension();
// membuat nama file random berikut extension
$filename = md5(time()) . '.' . $extension;
// menyimpan cover ke folder public/img
$destinationPath = public_path() . DIRECTORY_SEPARATOR . 'img';
$uploaded_cover->move($destinationPath, $filename);
// mengisi field cover di food dengan filename yang baru dibuat
$food->cover = $filename;
$food->save();
}
Session::flash("flash_notification", [
"level"=>"success",
"message"=>"Berhasil menyimpan $food->title"
]);
return redirect()->route('foods.index');
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$food = Food::find($id);
return view('foods.edit')->with(compact('food'));
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(UpdateFoodRequest $request, $id)
{
$food = Food::find($id);
if(!$food->update($request->all())) return redirect()->back();
if ($request->hasFile('cover')) {
// menambil cover yang diupload berikut ekstensinya
$filename = null;
$uploaded_cover = $request->file('cover');
$extension = $uploaded_cover->getClientOriginalExtension();
// membuat nama file random dengan extension
$filename = md5(time()) . '.' . $extension;
$destinationPath = public_path() . DIRECTORY_SEPARATOR . 'img';
// memindahkan file ke folder public/img
$uploaded_cover->move($destinationPath, $filename);
// hapus cover lama, jika ada
if ($food->cover) {
$old_cover = $food->cover;
$filepath = public_path() . DIRECTORY_SEPARATOR . 'img'
. DIRECTORY_SEPARATOR . $food->cover;
try {
File::delete($filepath);
} catch (FileNotFoundException $e) {
// File sudah dihapus/tidak ada
}
}
// ganti field cover dengan cover yang baru
$food->cover = $filename;
$food->save();
}
Session::flash("flash_notification", [
"level"=>"success",
"message"=>"Berhasil menyimpan $food->title"
]);
return redirect()->route('foods.index');
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
// public function destroy(Request $request, $id)
// {
// $food = Food::find($id);
// $cover = $food->cover;
// if(!$food->delete()) return redirect()->back();
//
// // handle hapus buku via ajax
// if ($request->ajax()) return response()->json(['id' => $id]);
//
// // hapus cover lama, jika ada
// if ($cover) {
// $old_cover = $food->cover;
// $filepath = public_path() . DIRECTORY_SEPARATOR . 'img'
// . DIRECTORY_SEPARATOR . $food->cover;
//
// try {
// File::delete($filepath);
// } catch (FileNotFoundException $e) {
// // File sudah dihapus/tidak ada
// }
// }
//
// Session::flash("flash_notification", [
// "level"=>"success",
// "message"=>"daftar berhasil dihapus"
// ]);
//
// return redirect()->route('foods.index');
// }
public function returnBack($food_id)
{
$borrowLog = BorrowLog::where('user_id', Auth::user()->id)
->where('food_id', $food_id)
->where('is_returned', 0)
->first();
if ($borrowLog) {
$borrowLog->is_returned = true;
$borrowLog->save();
Session::flash("flash_notification", [
"level" => "success",
"message" => "Berhasil mengembalikan " . $borrowLog->food->title
]);
}
return redirect('/home');
}
public function export()
{
return view('foods.export');
}
public function exportPost(Request $request)
{
// validasi
$this->validate($request, [
'author_id'=>'required',
'type'=>'required|in:pdf,xls'
], [
'author_id.required'=>'Anda belum registrasi. silahkan registrasi terlebih dahulu.'
]);
$foods = Food::whereIn('id', $request->get('author_id'))->get();
$handler = 'export' . ucfirst($request->get('type'));
return $this->$handler($foods);
}
private function exportPdf($foods)
{
$pdf = PDF::loadview('pdf.foods', compact('foods'));
return $pdf->download('foods.pdf');
}
}
<?php <?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Pesanan as pesanan;
use App\Http\Requests\StorePesananRequest;
use App\Http\Requests\UpdatePesananRequest;
use Yajra\Datatables\Html\Builder;
use Yajra\Datatables\Datatables;
class PesananController extends Controller class PesananController extends Controller
{ {
/** public function _construct()
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request, Builder $htmlBuilder)
{
if ($request->ajax()) {
$books = Book::with('author');
return Datatables::of($books)
->addColumn('stock', function($book){
return $book->stock;
})
->addColumn('action', function($book){
return view('datatable._action', [
'model' => $book,
'form_url' => route('books.destroy', $book->id),
'edit_url' => route('books.edit', $book->id),
'confirm_message' => 'Yakin ingin menghapus ' . $book->title . '?',
]);
})->make(true);
}
$html = $htmlBuilder
->addColumn(['data' => 'title', 'name'=>'title', 'title'=>'Jenis Makanan'])
->addColumn(['data' => 'stock', 'name'=>'amount', 'title'=>'Stock'])
->addColumn(['data' => 'harga', 'name'=>'harga', 'title'=>'harga'])
->addColumn(['data' => 'author.name', 'name'=>'author.name', 'title'=>'chef'])
->addColumn(['data' => 'action', 'name'=>'action', 'title'=>'Action', 'orderable'=>false, 'searchable'=>false]);
return view('books.index')->with(compact('html'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return view('books.create');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function borrow($id)
{
try {
$book = Book::findOrFail($id);
Auth::user()->borrow($book);
Session::flash("flash_notification", [
"level"=>"success",
"message"=>"Berhasil memesan $book->title"
]);
} catch (BookException $e) {
Session::flash("flash_notification", [
"level" => "danger",
"message" => $e->getMessage()
]);
} catch (ModelNotFoundException $e) {
Session::flash("flash_notification", [
"level" => "danger",
"message" => "Makanan tidak ditemukan."
]);
}
return redirect('/');
}
public function store(StoreBookRequest $request)
{
$book = Book::create($request->except('cover'));
// isi field cover jika ada cover yang diupload
if ($request->hasFile('cover')) {
// Mengambil file yang diupload
$uploaded_cover = $request->file('cover');
// mengambil extension file
$extension = $uploaded_cover->getClientOriginalExtension();
// membuat nama file random berikut extension
$filename = md5(time()) . '.' . $extension;
// menyimpan cover ke folder public/img
$destinationPath = public_path() . DIRECTORY_SEPARATOR . 'img';
$uploaded_cover->move($destinationPath, $filename);
// mengisi field cover di book dengan filename yang baru dibuat
$book->cover = $filename;
$book->save();
}
Session::flash("flash_notification", [
"level"=>"success",
"message"=>"Berhasil menyimpan $book->title"
]);
return redirect()->route('books.index');
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$author = Author::find($id);
return view('authors.edit')->with(compact('author'));
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(UpdateBookRequest $request, $id)
{
$book = Book::find($id);
if(!$book->update($request->all())) return redirect()->back();
if ($request->hasFile('cover')) {
// menambil cover yang diupload berikut ekstensinya
$filename = null;
$uploaded_cover = $request->file('cover');
$extension = $uploaded_cover->getClientOriginalExtension();
// membuat nama file random dengan extension
$filename = md5(time()) . '.' . $extension;
$destinationPath = public_path() . DIRECTORY_SEPARATOR . 'img';
// memindahkan file ke folder public/img
$uploaded_cover->move($destinationPath, $filename);
// hapus cover lama, jika ada
if ($book->cover) {
$old_cover = $book->cover;
$filepath = public_path() . DIRECTORY_SEPARATOR . 'img'
. DIRECTORY_SEPARATOR . $book->cover;
try {
File::delete($filepath);
} catch (FileNotFoundException $e) {
// File sudah dihapus/tidak ada
}
}
// ganti field cover dengan cover yang baru
$book->cover = $filename;
$book->save();
}
Session::flash("flash_notification", [
"level"=>"success",
"message"=>"Berhasil menyimpan $book->title"
]);
return redirect()->route('books.index');
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy(Request $request, $id)
{ {
$book = Book::find($id); View::share('menu')
$cover = $book->cover;
if(!$book->delete()) return redirect()->back();
// handle hapus buku via ajax
if ($request->ajax()) return response()->json(['id' => $id]);
// hapus cover lama, jika ada
if ($cover) {
$old_cover = $book->cover;
$filepath = public_path() . DIRECTORY_SEPARATOR . 'img'
. DIRECTORY_SEPARATOR . $book->cover;
try {
File::delete($filepath);
} catch (FileNotFoundException $e) {
// File sudah dihapus/tidak ada
}
}
Session::flash("flash_notification", [
"level"=>"success",
"message"=>"daftar berhasil dihapus"
]);
return redirect()->route('books.index');
}
public function returnBack($book_id)
{
$borrowLog = BorrowLog::where('user_id', Auth::user()->id)
->where('book_id', $book_id)
->where('is_returned', 0)
->first();
if ($borrowLog) {
$borrowLog->is_returned = true;
$borrowLog->save();
Session::flash("flash_notification", [
"level" => "success",
"message" => "Berhasil mengembalikan " . $borrowLog->book->title
]);
}
return redirect('/home');
} }
public function export() }
{ \ No newline at end of file
return view('books.export');
}
public function exportPost(Request $request)
{
// validasi
$this->validate($request, [
'author_id'=>'required',
'type'=>'required|in:pdf,xls'
], [
'author_id.required'=>'Anda belum registrasi. silahkan registrasi terlebih dahulu.'
]);
$books = Book::whereIn('id', $request->get('author_id'))->get();
$handler = 'export' . ucfirst($request->get('type'));
return $this->$handler($books);
}
private function exportPdf($books)
{
$pdf = PDF::loadview('pdf.books', compact('books'));
return $pdf->download('books.pdf');
}
}
...@@ -8,9 +8,6 @@ use App\Http\Requests\StorePegawaiRequest; ...@@ -8,9 +8,6 @@ use App\Http\Requests\StorePegawaiRequest;
use App\Http\Requests\UpdatePegawaiRequest; use App\Http\Requests\UpdatePegawaiRequest;
use Yajra\Datatables\Html\Builder; use Yajra\Datatables\Html\Builder;
use Yajra\Datatables\Datatables; use Yajra\Datatables\Datatables;
use App\Book;
use App\Author;
use App\session;
class pegawaiController extends Controller class pegawaiController extends Controller
{ {
...@@ -59,7 +56,7 @@ class pegawaiController extends Controller ...@@ -59,7 +56,7 @@ class pegawaiController extends Controller
*/ */
public function create() public function create()
{ {
return view('authors._form_pegawai'); return view('authors.create');
} }
/** /**
...@@ -73,24 +70,24 @@ class pegawaiController extends Controller ...@@ -73,24 +70,24 @@ class pegawaiController extends Controller
$pegawai = pegawai::create($request->except('cover')); $pegawai = pegawai::create($request->except('cover'));
// isi field cover jika ada cover yang diupload // isi field cover jika ada cover yang diupload
// if ($request->hasFile('cover')) { if ($request->hasFile('cover')) {
//// Mengambil file yang diupload // Mengambil file yang diupload
// $uploaded_cover = $request->file('cover'); $uploaded_cover = $request->file('cover');
//// mengambil extension file // mengambil extension file
// $extension = $uploaded_cover->getClientOriginalExtension(); $extension = $uploaded_cover->getClientOriginalExtension();
//// membuat nama file random berikut extension // membuat nama file random berikut extension
// $filename = md5(time()) . '.' . $extension; $filename = md5(time()) . '.' . $extension;
//// menyimpan cover ke folder public/img // menyimpan cover ke folder public/img
// $destinationPath = public_path() . DIRECTORY_SEPARATOR . 'img'; $destinationPath = public_path() . DIRECTORY_SEPARATOR . 'img';
// $uploaded_cover->move($destinationPath, $filename); $uploaded_cover->move($destinationPath, $filename);
//// mengisi field cover di pegawai dengan filename yang baru dibuat // mengisi field cover di pegawai dengan filename yang baru dibuat
// $pegawai->cover = $filename; $pegawai->cover = $filename;
// $pegawai->save(); $pegawai->save();
// } }
// Session::flash("flash_notification", [ Session::flash("flash_notification", [
// "level"=>"success", "level"=>"success",
// "message"=>"Berhasil menyimpan $pegawai->name" "message"=>"Berhasil menyimpan $pegawai->name"
// ]); ]);
return redirect()->route('pegawai.index'); return redirect()->route('pegawai.index');
} }
/** /**
...@@ -112,8 +109,7 @@ class pegawaiController extends Controller ...@@ -112,8 +109,7 @@ class pegawaiController extends Controller
*/ */
public function edit($id) public function edit($id)
{ {
$author = Author::find($id); //
return view('authors.create')->with(compact('author'));
} }
/** /**
...@@ -136,13 +132,6 @@ class pegawaiController extends Controller ...@@ -136,13 +132,6 @@ class pegawaiController extends Controller
*/ */
public function destroy($id) public function destroy($id)
{ {
if(!Author::destroy($id)) return redirect()->back(); //
Session::flash("flash_notification", [
"level"=>"success",
"message"=>"Berhasil dihapus"
]);
return redirect()->route('authors.index');
} }
} }
...@@ -14,7 +14,7 @@ class UpdateBookRequest extends StoreBookRequest ...@@ -14,7 +14,7 @@ class UpdateBookRequest extends StoreBookRequest
'cover' => 'Required', 'cover' => 'Required',
]; ];
// $rules = parent::rules(); // $rules = parent::rules();
// $rules['title'] = 'required|unique:books,title,' . $this->route('book'); // $rules['title'] = 'required|unique:foods,title,' . $this->route('book');
// return $rules; // return $rules;
} }
} }
......
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Order extends Model
{
protected $fillable = ['id', 'id_food', 'name', 'jumlah', 'total_harga', 'alamat','nomor_telepon','status'];
protected $table = 'order';
public static function boot()
{
parent::boot();
}
}
\ No newline at end of file
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Verifikasi extends Model
{
protected $fillable = ['id', 'id_food', 'name', 'jumlah'];
protected $table = 'verifikasi';
public static function boot()
{
parent::boot();
}
}
\ No newline at end of file
...@@ -14,13 +14,13 @@ class CreateUsersTable extends Migration ...@@ -14,13 +14,13 @@ class CreateUsersTable extends Migration
public function up() public function up()
{ {
Schema::create('users', function (Blueprint $table) { Schema::create('users', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
$table->string('name'); $table->string('name');
$table->string('email')->unique(); $table->string('email')->unique();
$table->string('password'); $table->string('password');
$table->rememberToken(); $table->rememberToken();
$table->timestamps(); $table->timestamps();
}); });
} }
/** /**
......
<?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->string('title')->unique();
$table->string('content');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('posts');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateBooksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('books', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->integer('author_id')->unsigned();
$table->integer('amount')->unsigned();
$table->string('harga');
$table->string('cover')->nullable();
$table->timestamps();
$table->foreign('author_id')->references('id')->on('authors')
->onUpdate('cascade')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('books');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateBorrowLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('borrow_logs', function (Blueprint $table) {
$table->increments('id');
$table->integer('book_id')->unsigned()->index();
$table->foreign('book_id')->references('id')->on('books')
->onDelete('cascade')
->onUpdate('cascade');
$table->integer('user_id')->unsigned()->index();
$table->foreign('user_id')->references('id')->on('users')
->onDelete('cascade')
->onUpdate('cascade');
$table->boolean('is_returned')->default(false);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('borrow_logs');
}
}
...@@ -13,12 +13,15 @@ class CreatePesananTable extends Migration ...@@ -13,12 +13,15 @@ class CreatePesananTable extends Migration
*/ */
public function up() public function up()
{ {
Schema::create('pesanan', function (Blueprint $table) { Schema::create('order', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
$table->integer('id_food');
$table->string('name'); $table->string('name');
$table->integer('jumlah');
$table->integer('total_harga');
$table->string('alamat'); $table->string('alamat');
$table->string('umur'); $table->bigInteger('nomor_telepon');
$table->string('golongan'); $table->string('status');
$table->timestamps(); $table->timestamps();
}); });
} }
...@@ -30,6 +33,6 @@ class CreatePesananTable extends Migration ...@@ -30,6 +33,6 @@ class CreatePesananTable extends Migration
*/ */
public function down() public function down()
{ {
// Schema::drop('order');
} }
} }
...@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema; ...@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreateAuthorsTable extends Migration class CreateMakananTable extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
...@@ -13,10 +13,12 @@ class CreateAuthorsTable extends Migration ...@@ -13,10 +13,12 @@ class CreateAuthorsTable extends Migration
*/ */
public function up() public function up()
{ {
Schema::create('authors', function (Blueprint $table) { Schema::create('food', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
$table->string('name'); $table->string('name');
$table->timestamps(); $table->string('type');
$table->integer('harga');
$table->timestamps();
}); });
} }
...@@ -27,6 +29,6 @@ $table->timestamps(); ...@@ -27,6 +29,6 @@ $table->timestamps();
*/ */
public function down() public function down()
{ {
Schema::dropIfExists('authors'); Schema::drop('food');
} }
} }
...@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema; ...@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreatepegawaiTable extends Migration class CreateVerifikasiTable extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
...@@ -13,12 +13,11 @@ class CreatepegawaiTable extends Migration ...@@ -13,12 +13,11 @@ class CreatepegawaiTable extends Migration
*/ */
public function up() public function up()
{ {
Schema::create('pegawai', function (Blueprint $table) { Schema::create('verifikasi', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
$table->integer('id_food');
$table->string('name'); $table->string('name');
$table->string('alamat'); $table->integer('jumlah');
$table->string('umur');
$table->string('golongan');
$table->timestamps(); $table->timestamps();
}); });
} }
...@@ -30,6 +29,6 @@ class CreatepegawaiTable extends Migration ...@@ -30,6 +29,6 @@ class CreatepegawaiTable extends Migration
*/ */
public function down() public function down()
{ {
Schema::drop('pegawai'); Schema::drop('verifikasi');
} }
} }
...@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema; ...@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreatePegawaisTable extends Migration class CreatePembayaranTable extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
...@@ -13,12 +13,11 @@ class CreatePegawaisTable extends Migration ...@@ -13,12 +13,11 @@ class CreatePegawaisTable extends Migration
*/ */
public function up() public function up()
{ {
Schema::create('pegawais', function (Blueprint $table) { Schema::create('paid', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
$table->integer('id_food');
$table->string('name'); $table->string('name');
$table->string('alamat'); $table->integer('jumlah');
$table->string('umur');
$table->string('golongan');
$table->timestamps(); $table->timestamps();
}); });
} }
...@@ -30,6 +29,6 @@ class CreatePegawaisTable extends Migration ...@@ -30,6 +29,6 @@ class CreatePegawaisTable extends Migration
*/ */
public function down() public function down()
{ {
Schema::drop('pegawais'); Schema::drop('paid');
} }
} }
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
<section id="main-content"> <section id="main-content">
<section class="wrapper"> <section class="wrapper">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<br> <br>
<div class="col-md-10"> <div class="col-md-10">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="{{ url('/home') }}">Dashboard</a></li> <li><a href="{{ url('/home') }}">Dashboard</a></li>
<li class="active">Pelanggan</li> <li class="active">Daftar Makanan</li>
</ul> <li class="active">ORDER</li>
<div class="panel panel-default"> </ul>
<div class="panel-heading"> <div class="panel panel-default">
<h2 class="panel-title">Pelanggan</h2> <div class="panel-heading">
</div> <h2 class="panel-title">Daftar Pesanan</h2>
</div>
<div class="panel-body">
<p> <div class="panel-body">
<a class="btn btn-primary" href="{{ url('/admin/books/create') }}">Ubah</a> <table class="table">
<a class="btn btn-primary" href="{{ url('/admin/export/books') }}">Export</a>
</p>
{!! $html->table(['class'=>'table-striped']) !!} <tr>
</div> <td><?php echo $food->name; ?></td>
</div> <td><?php echo $food->harga; ?></td>
</div> <td><?php echo $food->type; ?></td>
</div> </tr>
</div>
</section>
</section>
</table>
<p>
@endsection <a class="btn btn-primary" href="{{ url('foods') }}">Verified!</a>
</p>
</div>
</div>
</div>
</div>
</div>
</section>
</section>
@section('scripts')
{!! $html->scripts() !!}
@endsection @endsection
@extends('layouts.app')
@section('content')
<section id="main-content">
<section class="wrapper">
<div class="container">
<div class="row">
<br>
<div class="col-md-10">
<ul class="breadcrumb">
<li><a href="{{ url('/home') }}">Dashboard</a></li>
<li class="active">Daftar Makanan</li>
</ul>
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">Hai! Welcome to Pizza Andaliman! Please order your favorite food :)</h2>
</div>
<div class="panel-body">
<table class="table">
<thead>
<tr>
<th>Number</th>
<th>Food</th>
<th>Price</th>
<th>Type</th>
</tr>
</thead>
<?php $no=1; ?>
@foreach($food as $food)
<tr>
<td>{{$no++}}</td>
<td>{{$food->name}}</td>
<td>{{$food->harga}}</td>
<td>{{$food->type}}</td>
<td>
<a class="btn btn-primary" href={{url('order',$food->id)}}>ORDER</a>
</td>
</tr>
@endforeach
</table>
<p>
</p>
</div>
</div>
</div>
</div>
</div>
</section>
</section>
@endsection
@extends('layouts.app')
@section('content')
<section id="main-content">
<section class="wrapper">
<div class="container">
<div class="row">
<br>
<div class="col-md-10">
<ul class="breadcrumb">
<li><a href="{{ url('/home') }}">Dashboard</a></li>
<li class="active">Daftar Makanan</li>
<li class="active">ORDER</li>
</ul>
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">Terima kasih telah memesan di Pizza Andaliman! Silahkan menunggu :)</h2>
</div>
<div class="panel-body">
<table class="table">
<thead>
<tr>
<th>Nama Makanan</th>
<th>Harga</th>
<th>Jumlah</th>
<th>Total Harga</th>
<th>Type</th>
<th>Alamat</th>
<th>Nomor Telepon</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $food->name; ?></td>
<td><?php echo $food->harga; ?></td>
<td><?php echo $order->jumlah; ?></td>
<td><?php echo ($food->harga*$order->total_harga); ?></td>
<td><?php echo $food->type; ?></td>
<td><?php echo $order->alamat; ?></td>
<td><?php echo $order->nomor_telepon; ?></td>
</tr>
</tbody>
<td>
<a class="btn btn-danger" href={{url('cancel',$order->id)}}>CANCEL</a>
<a class="btn btn-warning" href={{url('paid',$order->id)}} >PAID</a>
</td>
</table>
<p>
</p>
</div>
</div>
</div>
</div>
</div>
</section>
</section>
@endsection
@extends('layouts.app')
@section('content')
<section id="main-content">
<section class="wrapper">
<div class="container">
<div class="row">
<br>
<div class="col-md-10">
<ul class="breadcrumb">
<li><a href="{{ url('/home') }}">Dashboard</a></li>
<li class="active">Daftar Makanan</li>
</ul>
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">Hai! Welcome to Pizza Andaliman! Please order your favorite food :)</h2>
</div>
<div class="panel-body">
<table class="table">
<?php $no=1; ?>
@foreach($food as $food)
<thead>
<tr>
<th>Nama Makanan</th>
<th>Harga</th>
<th>Jumlah</th>
<th>Total Harga</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{$no++}}</td>
<td>{{$food->name}}</td>
<td>{{$food->harga}}</td>
<td>{{$food->type}}</td>
<td>
<a class="btn btn-primary" href={{url('order',$food->id)}}>ORDER</a>
</td>
</tr>
</tbody>
@endforeach
</table>
<p>
</p>
</div>
</div>
</div>
</div>
</div>
</section>
</section>
@endsection
...@@ -10,21 +10,13 @@ ...@@ -10,21 +10,13 @@
<br> <br>
<div class="col-md-10"> <div class="col-md-10">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="{{ url('/home') }}">Dashboard</a></li> <li><a href="{{ url('/home') }}</li>
<li><a href="{{ url('/admin/authors') }}">Pelanggan</a></li>
<li class="active">Ubah Pelanggan</li>
</ul> </ul>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Ubah Pelanggan</h2> <h2 class="panel-title">Terima kasih telah melakukan pembayaran. Silahkan tunggu pesanan Anda. Have a nice day :)</h2>
</div> </div>
<div class="panel-body">
{!! Form::model($author, ['url' => route('authors.update', $author->id),
'method'=>'put', 'class'=>'form-horizontal']) !!}
@include('authors.create_data_pegawai')
{!! Form::close() !!}
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -32,5 +24,6 @@ ...@@ -32,5 +24,6 @@
</section> </section>
</section> </section>
@endsection @endsection
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
<section id="main-content"> <section id="main-content">
<section class="wrapper"> <section class="wrapper">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<br> <br>
<div class="col-md-10"> <div class="col-md-10">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="{{ url('/home') }}">Dashboard</a></li> <li><a href="{{ url('/home') }}">Dashboard</a></li>
<li><a href="{{ url('/admin/books') }}">Pelanggan</a></li> <li><a href="{{ url('foods') }}">Pelanggan</a></li>
<li class="active">Lihat Makanan</li> <li class="active">ORDER</li>
</ul> </ul>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Lihat Makanan</h2> <h2 class="panel-title">Detail Pesanan</h2>
</div> </div>
<div class="panel-body"> <div class="panel-body">
{!! Form::open(['url' => route('books.store'), {!! Form::open(['url' => url('order/save'),
'method' => 'post', 'enctype'=>'multipart/form-data','files'=>'true', 'class'=>'form-horizontal']) !!} 'method' => 'post', 'class'=>'form-vertical']) !!}
@include('books._form') <th>Food Number</th>
{!! Form::close() !!} <br>
</div> <input type="text" name="id_food" value="<?=$food->id?>"/>
</div> <br>Total Pesanan</br>
</div> <input type="text" name="jumlah"/>
</div> <br>Alamat</br>
</div> <input type="text" name="alamat"/>
</section> <br>Nomor Telepon</br>
</section> <input type="text" name="nomor_telepon"/>
<input type="submit" name="submit" value="SAVE"/>
{!! Form::close() !!}
</div>
</div>
</div>
</div>
</div>
</section>
</section>
@endsection @endsection
...@@ -10,17 +10,17 @@ ...@@ -10,17 +10,17 @@
<div class="col-md-10"> <div class="col-md-10">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="{{ url('/home') }}">Dashboard</a></li> <li><a href="{{ url('/home') }}">Dashboard</a></li>
<li><a href="{{ url('/admin/books') }}">Pegawai</a></li> <li><a href="{{ url('foods') }}">Pelanggan</a></li>
<li class="active">Data Pegawai</li> <li class="active">Data Pelanggan</li>
</ul> </ul>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Data Pegawai</h2> <h2 class="panel-title">Data Pelanggan</h2>
</div> </div>
<div class="panel-body"> <div class="panel-body">
{!! Form::open(['url' => route('pegawai.store'), {!! Form::open(['url' => route('pegawai.store'),
'method' => 'post', 'enctype'=>'multipart/form-data','files'=>'true', 'class'=>'form-horizontal']) !!} 'method' => 'post', 'enctype'=>'multipart/form-data','files'=>'true', 'class'=>'form-horizontal']) !!}
@include('authors.create_data_pegawai') @include('foods._form')
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
</div> </div>
......
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
{!! Form::label('name', 'Nama', ['class'=>'col-md-2 control-label']) !!}
<div class="col-md-4">
{!! Form::text('name', null, ['class'=>'form-control']) !!}
{!! $errors->first('name', '<p class="help-block">:message</p>') !!}
</div>
</div>
<div class="form-group{{ $errors->has('alamat') ? ' has-error' : '' }}">
{!! Form::label('alamat', 'Alamat', ['class'=>'col-md-2 control-label']) !!}
<div class="col-md-4">
{!! Form::text('alamat', null, ['class'=>'form-control']) !!}
{!! $errors->first('alamat', '<p class="help-block">:message</p>') !!}
</div>
</div>
<div class="form-group{{ $errors->has('umur') ? ' has-error' : '' }}">
{!! Form::label('umur', 'Umur', ['class'=>'col-md-2 control-label']) !!}
<div class="col-md-4">
{!! Form::number('umur', null, ['class'=>'form-control', 'min'=>1]) !!}
{!! $errors->first('umur', '<p class="help-block">:message</p>') !!}
</div>
</div>
<div class="form-group{{ $errors->has('golongan') ? ' has-error' : '' }}">
{!! Form::label('golongan', 'Golongan', ['class'=>'col-md-2 control-label']) !!}
<div class="col-md-4">
{!! Form::text('golongan', null, ['class'=>'form-control']) !!}
{!! $errors->first('golongan', '<p class="help-block">:message</p>') !!}
</div>
</div>
<div class="form-group">
<div class="col-md-4 col-md-offset-2">
{!! Form::submit('Simpan', ['class'=>'btn btn-primary']) !!}
</div>
</div>
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="{{ url('/home') }}">Dashboard</a></li> <li><a href="{{ url('/home') }}">Dashboard</a></li>
<li><a href="{{ url('/admin/authors') }}">Pelanggan</a></li> <li><a href="{{ url('/admin/authors') }}">Pelanggan</a></li>
<li class="active">Ubah Pelanggan</li> <li class="active">Ubah Pesanan</li>
</ul> </ul>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Ubah Pelanggan</h2> <h2 class="panel-title">Ubah Pesanan</h2>
</div> </div>
<div class="panel-body"> <div class="panel-body">
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
</div> </div>
<div class="panel-body"> <div class="panel-body">
<p> <a class="btn btn-primary" href="{{ url('/admin/authors/1/edit') }}">Tambah</a> </p> <p> <a class="btn btn-primary" href="{{ route('authors.create') }}">Tambah</a> </p>
{!! $html->table(['class'=>'table-striped']) !!} {!! $html->table(['class'=>'table-striped']) !!}
</div> </div>
</div> </div>
......
@extends('layouts.app') '@extends('layouts.app')
@section('content') @section('content')
<section id="main-content"> <section id="main-content">
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">PizzaAndaliman</h2> <h2 class="panel-title">PizzaAndaliman</h2>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<p> <a class="btn btn-primary" href="{{ route('authors.create') }}">Tambah</a> </p> <p> <a class="btn btn-primary" href="{{ route('authors.create') }}">Tambah</a> </p>
......
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
<section id="main-content"> <section id="main-content">
<section class="wrapper"> <section class="wrapper">
<div class="container">
<div class="row">
<br>
<div class="col-md-10">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Dashboard</h2> <h2 class="panel-title">Dashboard</h2>
</div> </div>
<div class="panel-body">
Hai Chef! Selamat datang di menu Sistem Informasi Pemesanan Makanan Pizza Andaliman. Klik Daftar Pesanan untuk melihat pesanan hari ini :)
</div>
</div>
</section>
</section>
<div class="panel-body">
Welcome to PizzaAndaliman.
</div> @endsection
</div>
</div>
</div>
</div>
</section>
</section>
@endsection
@section('scripts') @section('scripts')
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
var unique_id = $.gritter.add({ var unique_id = $.gritter.add({
// (string | mandatory) the heading of the notification // (string | mandatory) the heading of the notification
title: "<span style='font-size: 12px;'>Welcome to PizzaAndaliman!", title: "<span style='font-size: 12px;'>Welcome to PizzaAndaliman!",
// (string | mandatory) the text inside the notification // (string | mandatory) the text inside the notification
text: ' <a href="#" target="_blank" style="color:#ffd777">PizzaAndaliman@gmail.com / 089672377544</a>', text: ' <a href="#" target="_blank" style="color:#ffd777">PizzaAndaliman@gmail.com / 081264721252</a>',
// (string | optional) the image to display on the left // (string | optional) the image to display on the left
image: 'css/theme/assets/img/pizza2.PNG', image: 'css/theme/assets/img/pizza2.PNG',
// (bool | optional) if you want it to fade out on its own or just sit there // (bool | optional) if you want it to fade out on its own or just sit there
sticky: true, sticky: true,
// (int | optional) the time you want it to be alive for before fading out // (int | optional) the time you want it to be alive for before fading out
time: '', time: '',
// (string | optional) the class name you want to apply to that specific message // (string | optional) the class name you want to apply to that specific message
class_name: 'my-sticky-class' class_name: 'my-sticky-class'
}); });
return false; return false;
}); });
</script> </script>
@endsection @endsection
\ No newline at end of file
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
<div class="col-md-4"> <div class="col-md-4">
{!! Form::number('amount', null, ['class'=>'form-control', 'min'=>1]) !!} {!! Form::number('amount', null, ['class'=>'form-control', 'min'=>1]) !!}
{!! $errors->first('amount', '<p class="help-block">:message</p>') !!} {!! $errors->first('amount', '<p class="help-block">:message</p>') !!}
@if (isset($book)) @if (isset($food))
<p class="help-block">{{ $book->borrowed }} makanan sedang dipesan</p> <p class="help-block">{{ $food->borrowed }} makanan sedang dipesan</p>
@endif @endif
</div> </div>
</div> </div>
...@@ -22,29 +22,29 @@ ...@@ -22,29 +22,29 @@
<div class="col-md-4"> <div class="col-md-4">
{!! Form::number('harga', null, ['class'=>'form-control', 'min'=>1]) !!} {!! Form::number('harga', null, ['class'=>'form-control', 'min'=>1]) !!}
{!! $errors->first('harga', '<p class="help-block">:message</p>') !!} {!! $errors->first('harga', '<p class="help-block">:message</p>') !!}
@if (isset($book)) @if (isset($food))
<p class="help-block">{{ $book->borrowed }} harga telah masuk</p> <p class="help-block">{{ $food->borrowed }} harga telah masuk</p>
@endif @endif
</div> </div>
</div> </div>
<div class="form-group {!! $errors->has('author_id') ? 'has-error' : '' !!}"> <div class="form-group {!! $errors->has('author_id') ? 'has-error' : '' !!}">
{!! Form::label('author_id', 'chef', ['class'=>'col-md-2 control-label']) !!} {!! Form::label('author_id', 'pemesan', ['class'=>'col-md-2 control-label']) !!}
<div class="col-md-4"> <div class="col-md-4">
{!! Form::select('author_id', [''=>'']+App\Author::pluck('name','id')->all(), null, [ {!! Form::select('author_id', [''=>'']+App\Author::pluck('name','id')->all(), null, [
'class'=>'js-selectize', 'class'=>'js-selectize',
'placeholder' => '']) !!} 'placeholder' => 'Pilih makanan']) !!}
{!! $errors->first('author_id', '<p class="help-block">:message</p>') !!} {!! $errors->first('author_id', '<p class="help-block">:message</p>') !!}
</div> </div>
</div> </div>
<div class="form-group{{ $errors->has('cover') ? ' has-error' : '' }}"> <div class="form-group{{ $errors->has('cover') ? ' has-error' : '' }}">
{!! Form::label('cover', 'gambar', ['class'=>'col-md-2 control-label']) !!} {!! Form::label('cover', 'pembayaran', ['class'=>'col-md-2 control-label']) !!}
<div class="col-md-4"> <div class="col-md-4">
{!! Form::file('cover') !!} {!! Form::file('cover') !!}
@if (isset($book) && $book->cover) @if (isset($food) && $food->cover)
<p> <p>
{!! Html::image(asset('img/'.$book->cover), null, ['class'=>'img-rounded img-responsive']) !!} {!! Html::image(asset('img/'.$food->cover), null, ['class'=>'img-rounded img-responsive']) !!}
</p> </p>
@endif @endif
{!! $errors->first('cover', '<p class="help-block">:message</p>') !!} {!! $errors->first('cover', '<p class="help-block">:message</p>') !!}
......
@extends('layouts.app')
@section('content')
<section id="main-content">
<section class="wrapper">
<div class="container">
<div class="row">
<br>
<div class="col-md-10">
<ul class="breadcrumb">
<li><a href="{{ url('/home') }}">Dashboard</a></li>
<li class="active">Daftar Makanan</li>
</ul>
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">Hai! Welcome to Pizza Andaliman! Please order your favorite food :)</h2>
</div>
<div class="panel-body">
<table class="table">
<thead>
<tr>
<th>Number</th>
<th>Food</th>
<th>Price</th>
<th>Type</th>
</tr>
</thead>
<?php $no=1; ?>
@foreach($food as $food)
<tr>
<td>{{$no++}}</td>
<td>{{$food->name}}</td>
<td>{{$food->harga}}</td>
<td>{{$food->type}}</td>
<td>
<a class="btn btn-danger" href={{url('delete',$food->id)}}>DELETE</a>
</td>
</tr>
@endforeach
</table>
<button class="btn btn-primary" href={{url('create')}}>CREATE</button>
</div>
</div>
</div>
</div>
</div>
</section>
</section>
@endsection
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<div class="panel panel-default"> <div class="panel panel-default">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="{{ url('/home') }}">Dashboard</a></li> <li><a href="{{ url('/home') }}">Dashboard</a></li>
<li><a href="{{ url('/admin/books') }}">Pelanggan</a></li> <li><a href="{{ url('foods') }}">Manager</a></li>
<li class="active">Pindah pesanan</li> <li class="active">Pindah pesanan</li>
</ul> </ul>
<div class="panel panel-default"> <div class="panel panel-default">
...@@ -21,9 +21,9 @@ ...@@ -21,9 +21,9 @@
</div> </div>
<div class="panel-body"> <div class="panel-body">
{!! Form::model($book, ['url' => route('books.update', $book->id), {!! Form::model($food, ['url' => route('foods', $food->id),
'method' => 'put', 'files'=>'true', 'class'=>'form-horizontal']) !!} 'method' => 'put', 'files'=>'true', 'class'=>'form-horizontal']) !!}
@include('books._form') @include('foods._form')
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
</div> </div>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<div class="col-md-10"> <div class="col-md-10">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="{{ url('/home') }}">Dashboard</a></li> <li><a href="{{ url('/home') }}">Dashboard</a></li>
<li><a href="{{ url('/admin/books') }}">Pelanggan</a></li> <li><a href="{{ url('foods') }}">Pelanggan</a></li>
<li class="active">Export data Makanan</li> <li class="active">Export data Makanan</li>
</ul> </ul>
<div class="panel panel-default"> <div class="panel panel-default">
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
{!! Form::select('author_id[]', [''=>'']+App\Author::pluck('name','id')->all(), null, [ {!! Form::select('author_id[]', [''=>'']+App\Author::pluck('name','id')->all(), null, [
'class'=>'js-selectize', 'class'=>'js-selectize',
'multiple', 'multiple',
'placeholder' => 'Pilih Pemesan']) !!} 'placeholder' => 'Pilih Penulis']) !!}
{!! $errors->first('author_id', '<p class="help-block">:message</p>') !!} {!! $errors->first('author_id', '<p class="help-block">:message</p>') !!}
</div> </div>
</div> </div>
......
@extends('layouts.app')
@section('content')
<section id="main-content">
<section class="wrapper">
<div class="container">
<div class="row">
<br>
<div class="col-md-10">
<ul class="breadcrumb">
<li><a href="{{ url('/home') }}">Dashboard</a></li>
<li class="active">Daftar Pesanan</li>
</ul>
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">Daftar Pesanan</h2>
</div>
<div class="panel-body">
<table class="table">
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>Id_Food</th>
<th>Nama</th>
<th>Jumlah</th>
<th>Alamat</th>
<th>Nomor Telepon</th>
</tr>
</thead>
<?php $no=1; ?>
@foreach($order as $order)
<tr>
<td>{{$order->id}}</td>
<td>{{$order->id_food}}</td>
<td>{{$order->name}}</td>
<td>{{$order->jumlah}}</td>
<td>{{$order->alamat}}</td>
<td>{{$order->nomor_telepon}}</td>
<td>
<a class="btn btn-warning" href={{url('verifikasi',$order->id)}} >VERIFIED</a>
</td>
</tr>
@endforeach
</div>
</div>
</div>
</div>
</div>
</section>
</section>
@endsection
@extends('layouts.app')
@section('content')
<section id="main-content">
<section class="wrapper">
<div class="container">
<div class="row">
<br>
<div class="col-md-10">
<ul class="breadcrumb">
<li><a href="{{ url('/home') }}">Dashboard</a></li>
<li class="active">Daftar Makanan</li>
</ul>
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">Hai! Welcome to Pizza Andaliman! Please order your favorite food :)</h2>
</div>
<div class="panel-body">
<table class="table">
<?php $no=1; ?>
@foreach($food as $food)
<thead>
<tr>
<th>Nama Makanan</th>
<th>Harga</th>
<th>Jumlah</th>
<th>Total Harga</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{$no++}}</td>
<td>{{$food->name}}</td>
<td>{{$food->harga}}</td>
<td>{{$food->type}}</td>
<td>
<a class="btn btn-primary" href={{url('order',$food->id)}}>ORDER</a>
</td>
</tr>
</tbody>
@endforeach
</table>
<p>
</p>
</div>
</div>
</div>
</div>
</div>
</section>
</section>
@endsection
@extends('layouts.app')
@section('content')
<section id="main-content">
<section class="wrapper">
<div class="container">
<div class="row">
<br>
<div class="col-md-10">
<ul class="breadcrumb">
<li><a href="{{ url('/home') }}">Dashboard</a></li>
<li><a href="{{ url('create') }}">Manager</a></li>
<li class="active">CREATE</li>
</ul>
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">Detail Makanan</h2>
</div>
<div class="panel-body">
{!! Form::open(['url' => url('food/save'),
'method' => 'post', 'class'=>'form-vertical']) !!}
<th>Food Number</th>
<br>
<input type="text" name="id_food"/>
<br>Nama</br>
<input type="text" name="name"/>
<br>Type</br>
<input type="text" name="type"/>
<br>Harga</br>
<input type="text" name="harga"/>
<input type="submit" name="submit" value="SAVE"/>
{!! Form::close() !!}
</div>
</div>
</div>
</div>
</div>
</section>
</section>
@endsection
...@@ -43,9 +43,9 @@ ...@@ -43,9 +43,9 @@
<!--logo end--> <!--logo end-->
<div class="nav notify-row" id="top_menu"> <div class="nav notify-row" id="top_menu">
<!-- notification start --> <!-- notification start -->
</div> </div>
<div class="top-menu"> <div class="top-menu">
...@@ -78,122 +78,76 @@ ...@@ -78,122 +78,76 @@
<p class="centered"><a href="#"><img src="{{ asset('css/theme/assets/img/pizza2.PNG') }}" class="img-circle" width="90"></a></p> <p class="centered"><a href="#"><img src="{{ asset('css/theme/assets/img/pizza2.PNG') }}" class="img-circle" width="90"></a></p>
<h5 class="centered" STYLE="font-size: 17px; color: #ffd317" >{{ Auth::user()->name }}</h5> <h5 class="centered" STYLE="font-size: 17px; color: #ffd317" >{{ Auth::user()->name }}</h5>
@if (Auth::check())
<li class="mt"> @if (!Auth::user()->id==1)
<a href="{{ url('/Listbook') }}"> <li class="mt">
<a href="{{ url('listFood') }}">
<i class="fa fa-dashboard"></i> <i class="fa fa-dashboard"></i>
<span>List Makanan</span> <span>List Makanan</span>
</a> </a>
</li> </li>
@endif @endif
@role('manager') @if (Auth::user()->id==5)
<li class="mt">
<li class="sub-menu"> <a href="{{ url('createFood') }}">
<a href="javascript:;" > <i class="fa fa-dashboard"></i>
<i class="fa fa-book"></i> <span>Menu Makanan</span>
<span>Data Makanan</span> </a>
</a> </li>
<ul class="sub"> <li class="mt">
<li><a href="{{ route('books.index') }}">Makanan</a></li> <a href="{{ url('listFood') }}">
<i class="fa fa-dashboard"></i>
</ul> <span>Rekapitulasi Penjualan</span>
</li> </a>
</li>
<li class="sub-menu"> <li class="mt">
<a href="javascript:;" > <a href="{{ url('listFood') }}">
<i class="fa fa-desktop"></i> <i class="fa fa-dashboard"></i>
<span>Data Pelanggan</span> <span>Data Pegawai</span>
</a> </a>
<ul class="sub"> </li>
<li><a href="{{ route('authors.index') }}">Pelanggan</a></li>
@elseif (Auth::user()->id==1)
</ul> <li class="mt">
</li> <a href="{{ url('listFood') }}">
<i class="fa fa-dashboard"></i>
<span>Daftar Pesanan</span>
<li class="sub-menu"> </a>
<a href="javascript:;" > </li>
<i class="fa fa-desktop"></i> <li class="mt">
<span>Data Pegawai</span> <a href="{{ url('listFood') }}">
</a> <i class="fa fa-dashboard"></i>
<ul class="sub"> <span>Laporan Penjualan</span>
<li><a href="{{ route('pegawai.index') }}">Pegawai</a></li> </a>
</li>
</ul>
</li> @elseif (Auth::user()->id>=2)
<li class="mt">
@endrole <a href="{{ url('listFoodCostumer') }}">
<i class="fa fa-dashboard"></i>
<span>Daftar Makanan</span>
@role('admin') </a>
<li class="sub-menu"> </li>
<a href="javascript:;" >
<i class="fa fa-desktop"></i>
<span>Data pesanan</span>
</a> @elseif (Auth::user()->id>=3)
<ul class="sub"> <li class="mt">
<li><a href="{{ route('books.index') }}">Pesanan</a></li> <a href="{{ url('/chef') }}">
<li><a href="{{ route('pegawai.index') }}">Pembayaran</a></li> <i class="fa fa-dashboard"></i>
<li><a href="{{ route('books.index') }}">laporan</a></li> <span>Daftar Pesanan</span>
</ul>
</li>
{{--<li class="sub-menu">--}}
{{--<a href="javascript:;" >--}}
{{--<i class="fa fa-desktop"></i>--}}
{{--<span>pembayaran</span>--}}
{{--</a>--}}
{{--<ul class="sub">--}}
{{--<li><a href="{{ route('authors.index') }}">Pembayaran</a></li>--}}
{{--</ul>--}}
{{--</li>--}}
{{--<li class="sub-menu">--}}
{{--<a href="javascript:;" >--}}
{{--<i class="fa fa-book"></i>--}}
{{--<span>Laporan</span>--}}
{{--</a>--}}
{{--<ul class="sub">--}}
{{--<li><a href="{{ route('books.index') }}">laporan</a></li>--}}
{{--</ul>--}}
{{--</li>--}}
@endrole
@role('deliver')
<li class="sub-menu">
<a href="javascript:;" >
<i class="fa fa-book"></i>
<span>Data Pesanan</span>
</a> </a>
<ul class="sub">
<li><a href="{{ route('books.index') }}">pesanan</a></li>
</ul>
</li> </li>
@endif
@endrole
@role('chef')
<li class="sub-menu">
<a href="javascript:;" >
<i class="fa fa-book"></i>
<span>Data Pesanan</span>
</a>
<ul class="sub">
<li><a href="{{ route('books.index') }}">Makanan</a></li>
</ul>
</li>
@endrole
</ul> </ul>
<!-- sidebar menu end--> <!-- sidebar menu end-->
</div> </div>
</aside> </aside>
@endif @endif
@include('layouts._flash') @include('layouts._flash')
@yield('content') @yield('content')
......
...@@ -13,35 +13,56 @@ ...@@ -13,35 +13,56 @@
Auth::routes(); Auth::routes();
Route::get('/', 'HomeController@index'); Route::get('/', 'HomeController@index');
Route::get('/Listbook', 'GuestController@index'); Route::get('/foods', 'FoodController@show');
Route::get('/listFood', 'FoodController@index');
Route::get('/listFoodCostumer', 'FoodController@index');
Route::get('/createFood', 'FoodController@create');
Route::get('/showFood', 'FoodController@index');
Route::resource('chef', 'ChefController');
Route::get('/home', 'HomeController@index'); Route::get('/home', 'HomeController@index');
Route::group(['prefix'=>'admin', 'middleware'=>['auth']], function () {
Route::group(['middleware'=>['web']], function () {
Route::resource('Manager', 'FoodController@show');
Route::post('order/save', 'OrderController@save');
Route::get('verifikasi/{id}', 'OrderController@verification');
});
Route::get('cancel/{id}', 'OrderController@destroy');
Route::get('paid/{id}', 'OrderController@paid');
Route::group(['middleware'=>['web']], function () {
Route::resource('order', 'OrderController@pesan');
});
Route::get('delete/{id}', 'OrderController@delete');
Route::resource('create', 'OrderController@create');
Route::post('food/save', 'OrderController@simpan');
/*Route::group(['prefix'=>'admin', 'middleware'=>['auth']], function () {
Route::resource('authors', 'AuthorsController'); Route::resource('authors', 'AuthorsController');
Route::resource('pegawai', 'PegawaiController'); Route::resource('pegawai', 'PegawaiController');
Route::resource('books', 'BooksController');
Route::get('export/books', [ Route::get('export/foods', [
'as' => 'export.books', 'as' => 'export.foods',
'uses' => 'BooksController@export' 'uses' => 'FoodController@export'
]); ]);
Route::post('export/books', [ Route::post('export/foods', [
'as' => 'export.books.post', 'as' => 'export.foods.post',
'uses' => 'BooksController@exportPost' 'uses' => 'FoodController@exportPost'
]); ]);
}); });
Route::get('books/{book}/borrow', [ Route::get('foods/{food}/borrow', [
'middleware' => ['auth'], 'middleware' => ['auth'],
'as' => 'guest.books.borrow', 'as' => 'guest.foods.borrow',
'uses' => 'BooksController@borrow' 'uses' => 'FoodController@borrow'
]); ]);
Route::put('books/{book}/return', [ Route::put('foods/{food}/return', [
'middleware' => ['auth'], 'middleware' => ['auth'],
'as' => 'member.books.return', 'as' => 'member.foods.return',
'uses' => 'BooksController@returnBack' 'uses' => 'FoodController@returnBack'
]); ]);
Route::get('/test/{pass}', function ($pass){ Route::get('/test/{pass}', function ($pass){
echo bcrypt($pass); echo bcrypt($pass);
}); });*/
\ No newline at end of file \ No newline at end of file
...@@ -46,7 +46,7 @@ INSERT INTO `authors` (`id`, `name`, `created_at`, `updated_at`) VALUES ...@@ -46,7 +46,7 @@ INSERT INTO `authors` (`id`, `name`, `created_at`, `updated_at`) VALUES
-- -------------------------------------------------------- -- --------------------------------------------------------
-- --
-- Table structure for table `books` -- Table structure for table `foods`
-- --
CREATE TABLE IF NOT EXISTS `books` ( CREATE TABLE IF NOT EXISTS `books` (
...@@ -61,7 +61,7 @@ CREATE TABLE IF NOT EXISTS `books` ( ...@@ -61,7 +61,7 @@ CREATE TABLE IF NOT EXISTS `books` (
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --
-- Dumping data for table `books` -- Dumping data for table `foods`
-- --
INSERT INTO `books` (`id`, `title`, `author_id`, `amount`, `cover`, `created_at`, `updated_at`) VALUES INSERT INTO `books` (`id`, `title`, `author_id`, `amount`, `cover`, `created_at`, `updated_at`) VALUES
...@@ -267,7 +267,7 @@ ALTER TABLE `authors` ...@@ -267,7 +267,7 @@ ALTER TABLE `authors`
ADD PRIMARY KEY (`id`); ADD PRIMARY KEY (`id`);
-- --
-- Indexes for table `books` -- Indexes for table `foods`
-- --
ALTER TABLE `books` ALTER TABLE `books`
ADD PRIMARY KEY (`id`), ADD PRIMARY KEY (`id`),
...@@ -346,7 +346,7 @@ ALTER TABLE `users` ...@@ -346,7 +346,7 @@ ALTER TABLE `users`
ALTER TABLE `authors` ALTER TABLE `authors`
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5; MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
-- --
-- AUTO_INCREMENT for table `books` -- AUTO_INCREMENT for table `foods`
-- --
ALTER TABLE `books` ALTER TABLE `books`
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=8; MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=8;
...@@ -385,7 +385,7 @@ ALTER TABLE `users` ...@@ -385,7 +385,7 @@ ALTER TABLE `users`
-- --
-- --
-- Constraints for table `books` -- Constraints for table `foods`
-- --
ALTER TABLE `books` ALTER TABLE `books`
ADD CONSTRAINT `books_author_id_foreign` FOREIGN KEY (`author_id`) REFERENCES `authors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; ADD CONSTRAINT `books_author_id_foreign` FOREIGN KEY (`author_id`) REFERENCES `authors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
......
...@@ -8,15 +8,12 @@ $baseDir = dirname($vendorDir); ...@@ -8,15 +8,12 @@ $baseDir = dirname($vendorDir);
return array( return array(
'BooksSeeder' => $baseDir . '/database/seeds/BooksSeeder.php', 'BooksSeeder' => $baseDir . '/database/seeds/BooksSeeder.php',
'Cpdf' => $vendorDir . '/dompdf/dompdf/lib/Cpdf.php', 'Cpdf' => $vendorDir . '/dompdf/dompdf/lib/Cpdf.php',
'CreateAuthorsTable' => $baseDir . '/database/migrations/2016_12_12_114448_create_authors_table.php', 'CreateMakananTable' => $baseDir . '/database/migrations/2017_06_07_091111_create_makanan_table.php',
'CreateBooksTable' => $baseDir . '/database/migrations/2016_12_12_120408_create_books_table.php',
'CreateBorrowLogsTable' => $baseDir . '/database/migrations/2016_12_30_094623_create_borrow_logs_table.php',
'CreatePasswordResetsTable' => $baseDir . '/database/migrations/2014_10_12_100000_create_password_resets_table.php', 'CreatePasswordResetsTable' => $baseDir . '/database/migrations/2014_10_12_100000_create_password_resets_table.php',
'CreatePegawaisTable' => $baseDir . '/database/migrations/2017_05_23_014312_create_pegawais_table.php', 'CreatePembayaranTable' => $baseDir . '/database/migrations/2017_06_11_141822_create_pembayaran_table.php',
'CreatePesananTable' => $baseDir . '/database/migrations/2017_05_22_071700_create_pesanan_table.php', 'CreatePesananTable' => $baseDir . '/database/migrations/2017_05_22_071700_create_pesanan_table.php',
'CreatePostsTable' => $baseDir . '/database/migrations/2016_12_11_110857_create_posts_table.php',
'CreateUsersTable' => $baseDir . '/database/migrations/2014_10_12_000000_create_users_table.php', 'CreateUsersTable' => $baseDir . '/database/migrations/2014_10_12_000000_create_users_table.php',
'CreatepegawaiTable' => $baseDir . '/database/migrations/2017_05_08_085711_create_pegawai_table.php', 'CreateVerifikasiTable' => $baseDir . '/database/migrations/2017_06_10_014145_create_verifikasi_table.php',
'DatabaseSeeder' => $baseDir . '/database/seeds/DatabaseSeeder.php', 'DatabaseSeeder' => $baseDir . '/database/seeds/DatabaseSeeder.php',
'File_Iterator' => $vendorDir . '/phpunit/php-file-iterator/src/Iterator.php', 'File_Iterator' => $vendorDir . '/phpunit/php-file-iterator/src/Iterator.php',
'File_Iterator_Facade' => $vendorDir . '/phpunit/php-file-iterator/src/Facade.php', 'File_Iterator_Facade' => $vendorDir . '/phpunit/php-file-iterator/src/Facade.php',
......
...@@ -352,15 +352,12 @@ class ComposerStaticInit6daa598fae9ed14b9ff672201755e79c ...@@ -352,15 +352,12 @@ class ComposerStaticInit6daa598fae9ed14b9ff672201755e79c
public static $classMap = array ( public static $classMap = array (
'BooksSeeder' => __DIR__ . '/../..' . '/database/seeds/BooksSeeder.php', 'BooksSeeder' => __DIR__ . '/../..' . '/database/seeds/BooksSeeder.php',
'Cpdf' => __DIR__ . '/..' . '/dompdf/dompdf/lib/Cpdf.php', 'Cpdf' => __DIR__ . '/..' . '/dompdf/dompdf/lib/Cpdf.php',
'CreateAuthorsTable' => __DIR__ . '/../..' . '/database/migrations/2016_12_12_114448_create_authors_table.php', 'CreateMakananTable' => __DIR__ . '/../..' . '/database/migrations/2017_06_07_091111_create_makanan_table.php',
'CreateBooksTable' => __DIR__ . '/../..' . '/database/migrations/2016_12_12_120408_create_books_table.php',
'CreateBorrowLogsTable' => __DIR__ . '/../..' . '/database/migrations/2016_12_30_094623_create_borrow_logs_table.php',
'CreatePasswordResetsTable' => __DIR__ . '/../..' . '/database/migrations/2014_10_12_100000_create_password_resets_table.php', 'CreatePasswordResetsTable' => __DIR__ . '/../..' . '/database/migrations/2014_10_12_100000_create_password_resets_table.php',
'CreatePegawaisTable' => __DIR__ . '/../..' . '/database/migrations/2017_05_23_014312_create_pegawais_table.php', 'CreatePembayaranTable' => __DIR__ . '/../..' . '/database/migrations/2017_06_11_141822_create_pembayaran_table.php',
'CreatePesananTable' => __DIR__ . '/../..' . '/database/migrations/2017_05_22_071700_create_pesanan_table.php', 'CreatePesananTable' => __DIR__ . '/../..' . '/database/migrations/2017_05_22_071700_create_pesanan_table.php',
'CreatePostsTable' => __DIR__ . '/../..' . '/database/migrations/2016_12_11_110857_create_posts_table.php',
'CreateUsersTable' => __DIR__ . '/../..' . '/database/migrations/2014_10_12_000000_create_users_table.php', 'CreateUsersTable' => __DIR__ . '/../..' . '/database/migrations/2014_10_12_000000_create_users_table.php',
'CreatepegawaiTable' => __DIR__ . '/../..' . '/database/migrations/2017_05_08_085711_create_pegawai_table.php', 'CreateVerifikasiTable' => __DIR__ . '/../..' . '/database/migrations/2017_06_10_014145_create_verifikasi_table.php',
'DatabaseSeeder' => __DIR__ . '/../..' . '/database/seeds/DatabaseSeeder.php', 'DatabaseSeeder' => __DIR__ . '/../..' . '/database/seeds/DatabaseSeeder.php',
'File_Iterator' => __DIR__ . '/..' . '/phpunit/php-file-iterator/src/Iterator.php', 'File_Iterator' => __DIR__ . '/..' . '/phpunit/php-file-iterator/src/Iterator.php',
'File_Iterator_Facade' => __DIR__ . '/..' . '/phpunit/php-file-iterator/src/Facade.php', 'File_Iterator_Facade' => __DIR__ . '/..' . '/phpunit/php-file-iterator/src/Facade.php',
......
...@@ -267,7 +267,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce ...@@ -267,7 +267,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
private $_sheets; private $_sheets;
/** /**
* External books * External foods
* *
* @var array * @var array
*/ */
......
...@@ -9,7 +9,7 @@ spl_autoload_register( ...@@ -9,7 +9,7 @@ spl_autoload_register(
$classes = array( $classes = array(
'sebastianbergmann\\comparator\\arraycomparatortest' => '/ArrayComparatorTest.php', 'sebastianbergmann\\comparator\\arraycomparatortest' => '/ArrayComparatorTest.php',
'sebastianbergmann\\comparator\\author' => '/_files/Author.php', 'sebastianbergmann\\comparator\\author' => '/_files/Author.php',
'sebastianbergmann\\comparator\\book' => '/_files/Book.php', 'sebastianbergmann\\comparator\\book' => '/_files/Food.php',
'sebastianbergmann\\comparator\\classwithtostring' => '/_files/ClassWithToString.php', 'sebastianbergmann\\comparator\\classwithtostring' => '/_files/ClassWithToString.php',
'sebastianbergmann\\comparator\\datetimecomparatortest' => '/DateTimeComparatorTest.php', 'sebastianbergmann\\comparator\\datetimecomparatortest' => '/DateTimeComparatorTest.php',
'sebastianbergmann\\comparator\\domnodecomparatortest' => '/DOMNodeComparatorTest.php', 'sebastianbergmann\\comparator\\domnodecomparatortest' => '/DOMNodeComparatorTest.php',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment