added booking table to admin home

integrate booking list to admin home
This commit is contained in:
Jack Goh
2018-06-21 17:35:08 +08:00
parent b5d8fd4e72
commit b9c0bc53fd
2 changed files with 38 additions and 3 deletions
+10 -2
View File
@@ -18,9 +18,17 @@ class BookingController extends Controller
{
public function index(){
$user = Auth::user();
if ($user->roles->first()->name == 'admin'){
$bookings = Booking::select('id', 'created_at', 'status', 'rate', 'term', 'amount', 'bia', 'verification_status')
->get();
}
else{
$bookings = Booking::select('id', 'created_at', 'status', 'rate', 'term', 'amount', 'bia', 'verification_status')
->where('user_id',Auth::user()->id)
->get();
->where('user_id', $user->id)
->get();
}
// reformat to fit frontend structure
foreach ($bookings as $booking) {