tastyigniter/ti-ext-reservation
Install via Composer:
composer require vendor/package-name
Publish the package config (if needed):
php artisan vendor:publish --provider="Vendor\PackageName\PackageServiceProvider"
First Use Case: Leverage location-aware filtering for scoped operations. Example:
// Update reservation status for a specific location (new in v4.1.4)
Reservation::updateStatusForLocation($locationId, 'confirmed');
// Sync calendar events with location context
Reservation::syncCalendarEvents($locationId);
Use the new location-scoped methods to avoid manual filtering:
// Location-specific status updates
Reservation::updateStatusForLocation($locationId, 'cancelled');
// Calendar sync with location context
Reservation::syncCalendarEvents($locationId, [
'timezone' => Location::find($locationId)->timezone,
'holidays' => LocationHolidays::get($locationId)
]);
public function updateStatus(Request $request, $locationId)
{
Reservation::updateStatusForLocation($locationId, $request->status);
}
class ReservationService {
public function bulkUpdateForLocation($locationId, array $updates)
{
Reservation::where('location_id', $locationId)->update($updates);
}
}
Extend calendar event syncing with location-specific rules:
// Location-aware sync with custom parameters
event(new SyncCalendarEvents($locationId, [
'timezone' => Location::find($locationId)->timezone,
'blackout_dates' => LocationBlackouts::get($locationId)
]));
$locationId before using location-aware methods:
if (!Location::exists($locationId)) {
throw new InvalidArgumentException("Location {$locationId} not found.");
}
Reservation::where('location_id', $locationId)->chunk(200, function ($reservations) {
// Process in batches
});
location_id column exists and is indexed:
php artisan schema:dump
public static function boot()
{
static::updating(function ($reservation) {
if ($reservation->isDirty('status') && !$reservation->location_id) {
throw new \Exception('Location required for status updates.');
}
});
}
class ReservationObserver {
public function saved(Reservation $reservation)
{
if ($reservation->wasRecentlyCreated && $reservation->location_id) {
Location::find($reservation->location_id)
->increment('reservation_count');
}
}
}
class Reservation extends Model {
public function scopeForLocation($query, $locationId)
{
return $query->where('location_id', $locationId);
}
}
How can I help you explore Laravel packages today?