added get one booking function in controller

update routes with booking id pramas
fixed not found routes
fixed count down with real data
moved bookings routes into autenticated route
This commit is contained in:
Jack Goh
2018-06-18 17:34:20 +08:00
parent f201f33f28
commit 97062480d5
7 changed files with 171 additions and 45 deletions
@@ -11,10 +11,29 @@ use App\UserBankSlip;
use App\User;
use Auth;
use Validator;
use DateTime;
class BookingController extends Controller
{
public function show($id)
{
$booking = Booking::where('user_id',Auth::user()->id)->where('id', $id)->first();
$date1 = new DateTime($booking->created_at);
$date2 = new DateTime();
$difference_in_seconds = ($date1->format('U') + 60) - ($date2->format('U'));
$booking->timeout = $difference_in_seconds;
if (!$booking){
return response()->json(['success'=>false, 'message'=>'not found'], 404);
}
return $booking;
}
public function store(Request $request)
{
$rates = Rate::orderby('updated_at','desc')->first();