These are chat archives for zeke8402/booking-app

30th
Nov 2015
Joselito Pasculado
@tolitz34
Nov 30 2015 00:53
yup i already add a user_id in Bookingdatetime table for using realationship. Now in calendar, I want to display the available days and time per user.
Zeke
@zeke8402
Nov 30 2015 02:20
So, you want to get all appointments for a user?
Or is it, that you have appointments assigned to certain users?
Joselito Pasculado
@tolitz34
Nov 30 2015 04:50
yup that's right, i want the appointments assigned to certain users. Actually i modify your code that the package table i changed to user table. So when i click the one user to view the calendar page, i want to view only available datetime that belongs to the one user.
I think i need to modify the code in API Controller or calendar.js but i know how.
Zeke
@zeke8402
Nov 30 2015 14:32
If you have your relations set up properly, you can do User::with('Appointment')->all(); and User::with('BookingDateTime')->all(), to get all appointments and availability assigned to a user
In users...
public function Appointment()
{
  return $this->hasMany('App\models\Appointment', 'id', 'appointment_id');
}
I think that's what you would need to do to make the above queries work