rename book_id in po table to booking_id to perform ORM relantionship

added relationship between booking and po
updated settings shows for different role
added function to display po for admin
This commit is contained in:
Jack Goh
2018-06-28 10:06:26 +08:00
parent 9432cdaaad
commit 2b4ddadfcb
7 changed files with 110 additions and 46 deletions
@@ -427,6 +427,13 @@ class BookingController extends Controller
return response()->json(['message'=>'Success'],200);
}
public function showPurchaseOrder($id){
$booking = Booking::where('id',$id)->first();
$user_po = $booking->purchaseOrder()->first();
return response()->json(['po_path'=> $user_po],200);
}
public function delete(Booking $book_id)
{
$booking = Booking::where('user_id', Auth::user())->where('id', $book_id)->firstOrFail();