avail
An API based availability calendar for Laravel 4.2, (*1)
Require Carbon\Carbon but already supplied by Laravel 4.2, (*2)
Installation
composer require anzware/avail
, (*3)
avail schema
run php artisan migrate --package="anzware/avail"
, (*4)
avail_calendars, (*5)
$table->bigIncrements('calendar_id');
$table->string('calendar_name', 255);
$table->string('status', 15);
$table->timestamps();
avail_bookings, (*6)
$table->bigIncrements('booking_id');
$table->bigInteger('calendar_id');
$table->date('calendar_date');
$table->bigInteger('state_id');
// external_booking_ids could be integer or string depending on external id data type
// assuming string as data type for good measure
$table->string('external_booking_id', 255)->nullable();
$table->timestamps();
Use external_booking_id to link your actual booking ID, (*7)
avail_states, (*8)
$table->bigIncrements('state_id');
$table->string('state', 100);
$table->tinyInteger('state_order')->nullable()->default(0);
$table->timestamps();
APIs
Getting calendar with data
GET /avail/api/get-calendar-with-data
, (*9)
Parameters, (*10)
integer take
(optional) - the amount of months needed to be displayed (default: 3), (*11)
integer page
(optional) - indicate the pagination starting from current month (default: 1), (*12)
integer calendar_id
(required) - the calendar ID, (*13)
Getting calendar list
GET /avail/api/get-calendar
, (*14)
Parameters, (*15)
integer calendar_id
(optional) - the calendar ID, (*16)
Getting state list
GET /avail/api/get-state
, (*17)
Parameters, (*18)
integer state_id
(optional) - the state ID, (*19)
Creating new calendar
POST /avail/api/post-new-calendar
, (*20)
Parameters, (*21)
string name
(required) - the calendar name, (*22)
string status
(required) - calendar status ('active', 'inactive'), (*23)
Update existing calendar
POST /avail/api/post-update-calendar
, (*24)
Parameters, (*25)
integer calendar_id
(required) - the calendar ID, (*26)
string name
(optional) - the calendar name, (*27)
string status
(optional) - calendar status ('active', 'inactive'), (*28)
Creating new state
POST /avail/api/post-new-state
, (*29)
Parameters, (*30)
integer calendar_id
(required) - the calendar ID, (*31)
string name
(optional) - the calendar name, (*32)
string status
(optional) - calendar status ('active', 'inactive'), (*33)
Update existing state
POST /avail/api/post-update-state
, (*34)
Parameters, (*35)
integer state_id
(required) - the state ID, (*36)
string state
(optional) - the name of the state, (*37)
integer state_order
(optional) - the order of the state, for displaying purpose, (*38)
Creating booking items
POST /avail/api/post-new-booking
, (*39)
Parameters, (*40)
integer calendar_id
(required) - the calendar ID, (*41)
integer state_id
(required) - the state ID, (*42)
array dates
(required) - selected dates, (*43)
string external_booking_id
(optional) - external booking ID (your actual booking detail ID), (*44)
Deleting booking items
POST /avail/api/post-release-booking
, (*45)
Parameters, (*46)
integer calendar_id
(required) - the calendar ID, (*47)
array dates
(required) - selected dates, (*48)