-
-
Save anonymous/a97a2ef9d8f9a532caf0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function Availability() { | |
$check = $this->Places - $this->Bookings()->Sum('NumSlots'); | |
if ($check < 1) { | |
return "Unavailable"; | |
} else { | |
return "Available"; | |
} | |
} | |
public function getAvailablePlaces() { | |
return $this->Places - $this->Bookings()->Sum('NumSlots'); | |
} | |
public function getAvailablePlacesDropDown() { | |
$placesremaining = $this->Places - $this->Bookings()->Sum('NumSlots'); | |
$range = range(1, $placesremaining, 1); | |
$fieldset = new DropdownField('NumSlots', 'NumSlots', array_combine($range, $range)); | |
return $fieldset; | |
} |
kinglozzer
commented
May 17, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment