Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Ti Ext Reservation Laravel Package

tastyigniter/ti-ext-reservation

View on GitHub
Deep Wiki
Context7

Getting Started

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);

Implementation Patterns

Location-Aware Operations

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)
]);

Workflow Integration

  1. Frontend: Pass location ID from UI (e.g., property selector).
  2. Controller: Use the new methods directly:
    public function updateStatus(Request $request, $locationId)
    {
        Reservation::updateStatusForLocation($locationId, $request->status);
    }
    
  3. Service Layer: Encapsulate location-aware logic:
    class ReservationService {
        public function bulkUpdateForLocation($locationId, array $updates)
        {
            Reservation::where('location_id', $locationId)->update($updates);
        }
    }
    

Event Syncing

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)
]));

Gotchas and Tips

Pitfalls

  • Missing Location Context: Always validate $locationId before using location-aware methods:
    if (!Location::exists($locationId)) {
        throw new InvalidArgumentException("Location {$locationId} not found.");
    }
    
  • Performance: For large locations, use chunking:
    Reservation::where('location_id', $locationId)->chunk(200, function ($reservations) {
        // Process in batches
    });
    

Debugging

  • Filtering Issues: Verify the location_id column exists and is indexed:
    php artisan schema:dump
    
  • Sync Conflicts: Check for timezone mismatches in location settings.

Extension Points

  • Custom Location Rules: Extend the model with location-specific validation:
    public static function boot()
    {
        static::updating(function ($reservation) {
            if ($reservation->isDirty('status') && !$reservation->location_id) {
                throw new \Exception('Location required for status updates.');
            }
        });
    }
    
  • Observer Hooks: Add location-aware logic:
    class ReservationObserver {
        public function saved(Reservation $reservation)
        {
            if ($reservation->wasRecentlyCreated && $reservation->location_id) {
                Location::find($reservation->location_id)
                    ->increment('reservation_count');
            }
        }
    }
    
  • Dynamic Scoping: Create location-specific query scopes:
    class Reservation extends Model {
        public function scopeForLocation($query, $locationId)
        {
            return $query->where('location_id', $locationId);
        }
    }
    
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor