GithubHelp home page GithubHelp logo

rinvex / laravel-bookings Goto Github PK

View Code? Open in Web Editor NEW
455.0 26.0 142.0 384 KB

⚠️ [ABANDONED] Rinvex Bookable is a generic resource booking system for Laravel, with the required tools to run your SAAS like services efficiently. It's simple architecture, accompanied by powerful underlying to afford solid platform for your business.

License: MIT License

PHP 100.00%
laravel php eloquent booking

laravel-bookings's Introduction

Rinvex Bookings

⚠️ This package is abandoned and no longer maintained. No replacement package was suggested. ⚠️

👉 If you are interested to step on as the main maintainer of this package, please reach out to me!


Rinvex Bookings is a generic resource booking system for Laravel, with the required tools to run your SAAS like services efficiently. It has a simple architecture, with powerful underlying to afford solid platform for your business.

Packagist Scrutinizer Code Quality Travis StyleCI License

Considerations

  • Rinvex Bookings is for bookable resources, and has nothing to do with price plans and subscriptions. If you're looking for subscription management system, you may have to look at rinvex/laravel-subscriptions.
  • Rinvex Bookings assumes that your resource model has at least three fields, price as a decimal field, and lastly unit as a string field which accepts one of (minute, hour, day, month) respectively.
  • Payments and ordering are out of scope for Rinvex Bookings, so you've to take care of this yourself. Booking price is calculated by this package, so you may need to hook into the process or listen to saved bookings to issue invoice, or trigger payment process.
  • You may extend Rinvex Bookings functionality to add features like: minimum and maximum units, and many more. These features may be supported natively sometime in the future.

Installation

  1. Install the package via composer:

    composer require rinvex/laravel-bookings
  2. Publish resources (migrations and config files):

    php artisan rinvex:publish:bookings
  3. Execute migrations via the following command:

    php artisan rinvex:migrate:bookings
  4. Done!

Usage

Rinvex Bookings has been specially made for Eloquent and simplicity has been taken very serious as in any other Laravel related aspect.

Add bookable functionality to your resource model

To add bookable functionality to your resource model just use the \Rinvex\Bookings\Traits\Bookable trait like this:

namespace App\Models;

use Rinvex\Bookings\Traits\Bookable;
use Illuminate\Database\Eloquent\Model;

class Room extends Model
{
    use Bookable;
}

That's it, you only have to use that trait in your Room model! Now your rooms will be bookable.

Add bookable functionality to your customer model

To add bookable functionality to your customer model just use the \Rinvex\Bookings\Traits\HasBookings trait like this:

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Rinvex\Bookings\Traits\HasBookings;

class Customer extends Model
{
    use HasBookings;
}

Again, that's all you need to do! Now your Customer model can book resources.

Create a new booking

Creating a new booking is straight forward, and could be done in many ways. Let's see how could we do that:

$room = \App\Models\Room::find(1);
$customer = \App\Models\Customer::find(1);

// Extends \Rinvex\Bookings\Models\BookableBooking
$serviceBooking = new \App\Models\ServiceBooking;

// Create a new booking via resource model (customer, starts, ends)
$room->newBooking($customer, '2017-07-05 12:44:12', '2017-07-10 18:30:11');

// Create a new booking via customer model (resource, starts, ends)
$customer->newBooking($room, '2017-07-05 12:44:12', '2017-07-10 18:30:11');

// Create a new booking explicitly
$serviceBooking->make(['starts_at' => \Carbon\Carbon::now(), 'ends_at' => \Carbon\Carbon::tomorrow()])
        ->customer()->associate($customer)
        ->bookable()->associate($room)
        ->save();

Notes:

  • As you can see, there's many ways to create a new booking, use whatever suits your context.
  • Booking price is calculated automatically on the fly according to the resource price, custom prices, and bookable Rates.
  • Rinvex Bookings is intelegent enough to detect date format and convert if required, the above example show the explicitly correct format, but you still can write something like: 'Tomorrow 1pm' and it will be converted automatically for you.

Query booking models

You can get more details about a specific booking as follows:

// Extends \Rinvex\Bookings\Models\BookableBooking
$serviceBooking = \App\Models\ServiceBooking::find(1);

$bookable = $serviceBooking->bookable; // Get the owning resource model
$customer = $serviceBooking->customer; // Get the owning customer model

$serviceBooking->isPast(); // Check if the booking is past
$serviceBooking->isFuture(); // Check if the booking is future
$serviceBooking->isCurrent(); // Check if the booking is current
$serviceBooking->isCancelled(); // Check if the booking is cancelled

And as expected, you can query bookings by date as well:

// Extends \Rinvex\Bookings\Models\BookableBooking
$serviceBooking = new \App\Models\ServiceBooking;

$pastBookings = $serviceBooking->past(); // Get the past bookings
$futureBookings = $serviceBooking->future(); // Get the future bookings
$currentBookings = $serviceBooking->current(); // Get the current bookings
$cancelledBookings = $serviceBooking->cancelled(); // Get the cancelled bookings

$serviceBookingsAfter = $serviceBooking->startsAfter('2017-06-21 19:28:51')->get(); // Get bookings starts after the given date
$serviceBookingsStartsBefore = $serviceBooking->startsBefore('2017-06-21 19:28:51')->get(); // Get bookings starts before the given date
$serviceBookingsBetween = $serviceBooking->startsBetween('2017-06-21 19:28:51', '2017-07-01 12:00:00')->get(); // Get bookings starts between the given dates

$serviceBookingsEndsAfter = $serviceBooking->endsAfter('2017-06-21 19:28:51')->get(); // Get bookings starts after the given date
$serviceBookingsEndsBefore = $serviceBooking->endsBefore('2017-06-21 19:28:51')->get(); // Get bookings starts before the given date
$serviceBookingsEndsBetween = $serviceBooking->endsBetween('2017-06-21 19:28:51', '2017-07-01 12:00:00')->get(); // Get bookings starts between the given dates

$serviceBookingsCancelledAfter = $serviceBooking->cancelledAfter('2017-06-21 19:28:51')->get(); // Get bookings starts after the given date
$serviceBookingsCancelledBefore = $serviceBooking->cancelledBefore('2017-06-21 19:28:51')->get(); // Get bookings starts before the given date
$serviceBookingsCancelledBetween = $serviceBooking->cancelledBetween('2017-06-21 19:28:51', '2017-07-01 12:00:00')->get(); // Get bookings starts between the given dates

$room = \App\Models\Room::find(1);
$serviceBookingsOfBookable = $serviceBooking->ofBookable($room)->get(); // Get bookings of the given resource

$customer = \App\Models\Customer::find(1);
$serviceBookingsOfCustomer = $serviceBooking->ofCustomer($customer)->get(); // Get bookings of the given customer

Create a new booking rate

Bookable Rates are special criteria used to modify the default booking price. For example, let’s assume that you have a resource charged per hour, and you need to set a higher price for the first "2" hours to cover certain costs, while discounting pricing if booked more than "5" hours. That’s totally achievable through bookable Rates. Simply set the amount of units to apply this criteria on, and state the percentage you’d like to have increased or decreased from the default price using +/- signs, i.e. -10%, and of course select the operator from: (^ means the first starting X units, < means when booking is less than X units, > means when booking is greater than X units). Allowed percentages could be between -100% and +100%.

To create a new booking rate, follow these steps:

$room = \App\Models\Room::find(1);
$room->newRate('15', '^', 2); // Increase unit price by 15% for the first 2 units
$room->newRate('-10', '>', 5); // Decrease unit price by 10% if booking is greater than 5 units

Alternatively you can create a new booking rate explicitly as follows:

$room = \App\Models\Room::find(1);

// Extends \Rinvex\Bookings\Models\BookableRate
$serviceRate = new \App\Models\ServiceRate;

$serviceRate->make(['percentage' => '15', 'operator' => '^', 'amount' => 2])
     ->bookable()->associate($room)
     ->save();

And here's the booking rate relations:

$bookable = $serviceRate->bookable; // Get the owning resource model

Notes:

  • All booking rate percentages should NEVER contain the % sign, it's known that this field is for percentage already.
  • When adding new booking rate with positive percentage, the + sign is NOT required, and will be omitted anyway if entered.

Create a new custom price

Custom prices are set according to specific time based criteria. For example, let’s say you've a Coworking Space business, and one of your rooms is a Conference Room, and you would like to charge differently for both Monday and Wednesday. Will assume that Monday from 09:00 am till 05:00 pm is a peak hours, so you need to charge more, and Wednesday from 11:30 am to 03:45 pm is dead hours so you'd like to charge less! That's totally achievable through custom prices, where you can set both time frames and their prices too using +/- percentage. It works the same way as Bookable Rates but on a time based criteria. Awesome, huh?

To create a custom price, follow these steps:

$room = \App\Models\Room::find(1);
$room->newPrice('mon', '09:00:00', '17:00:00', '26'); // Increase pricing on Monday from 09:00 am to 05:00 pm by 26%
$room->newPrice('wed', '11:30:00', '15:45:00', '-10.5'); // Decrease pricing on Wednesday from 11:30 am to 03:45 pm by 10.5%

Piece of cake, right? You just set the day, from-to times, and the +/- percentage to increase/decrease your unit price.

And here's the custom price relations:

$bookable = $room->bookable; // Get the owning resource model

Notes:

  • If you don't create any custom prices, then the resource will be booked at the default resource price.
  • Rinvex Bookings is intelegent enough to detect time format and convert if required, the above example show the explicitly correct format, but you still can write something like: '09:00 am' and it will be converted automatically for you.

Query resource models

You can query your resource models for further details, using the intuitive API as follows:

$room = \App\Models\Room::find(1);

$room->bookings; // Get all bookings
$room->pastBookings; // Get past bookings
$room->futureBookings; // Get future bookings
$room->currentBookings; // Get current bookings
$room->cancelledBookings; // Get cancelled bookings

$room->bookingsStartsBefore('2017-06-21 19:28:51')->get(); // Get bookings starts before the given date
$room->bookingsStartsAfter('2017-06-21 19:28:51')->get(); // Get bookings starts after the given date
$room->bookingsStartsBetween('2017-06-21 19:28:51', '2017-07-01 12:00:00')->get(); // Get bookings starts between the given dates

$room->bookingsEndsBefore('2017-06-21 19:28:51')->get(); // Get bookings starts before the given date
$room->bookingsEndsAfter('2017-06-21 19:28:51')->get(); // Get bookings starts after the given date
$room->bookingsEndsBetween('2017-06-21 19:28:51', '2017-07-01 12:00:00')->get(); // Get bookings starts between the given dates

$room->bookingsCancelledBefore('2017-06-21 19:28:51')->get(); // Get bookings starts before the given date
$room->bookingsCancelledAfter('2017-06-21 19:28:51')->get(); // Get bookings starts after the given date
$room->bookingsCancelledBetween('2017-06-21 19:28:51', '2017-07-01 12:00:00')->get(); // Get bookings starts between the given dates

$customer = \App\Models\Customer::find(1);
$room->bookingsOf($customer)->get(); // Get bookings of the given customer

$room->rates; // Get all bookable Rates
$room->prices; // Get all custom prices

All the above properties and methods are actually relationships, so you can call the raw relation methods and chain like any normal Eloquent relationship. E.g. $room->bookings()->where('starts_at', '>', new \Carbon\Carbon())->first().

Query customer models

Just like how you query your resources, you can query customers to retrieve related booking info easily. Look at these examples:

$customer = \App\Models\Customer::find(1);

$customer->bookings; // Get all bookings
$customer->pastBookings; // Get past bookings
$customer->futureBookings; // Get future bookings
$customer->currentBookings; // Get current bookings
$customer->cancelledBookings; // Get cancelled bookings

$customer->bookingsStartsBefore('2017-06-21 19:28:51')->get(); // Get bookings starts before the given date
$customer->bookingsStartsAfter('2017-06-21 19:28:51')->get(); // Get bookings starts after the given date
$customer->bookingsStartsBetween('2017-06-21 19:28:51', '2017-07-01 12:00:00')->get(); // Get bookings starts between the given dates

$customer->bookingsEndsBefore('2017-06-21 19:28:51')->get(); // Get bookings starts before the given date
$customer->bookingsEndsAfter('2017-06-21 19:28:51')->get(); // Get bookings starts after the given date
$customer->bookingsEndsBetween('2017-06-21 19:28:51', '2017-07-01 12:00:00')->get(); // Get bookings starts between the given dates

$customer->bookingsCancelledBefore('2017-06-21 19:28:51')->get(); // Get bookings starts before the given date
$customer->bookingsCancelledAfter('2017-06-21 19:28:51')->get(); // Get bookings starts after the given date
$customer->bookingsCancelledBetween('2017-06-21 19:28:51', '2017-07-01 12:00:00')->get(); // Get bookings starts between the given dates

$room = \App\Models\Room::find(1);
$customer->isBooked($room); // Check if the customer booked the given room
$customer->bookingsOf($room)->get(); // Get bookings by the customer for the given room

Just like resource models, all the above properties and methods are actually relationships, so you can call the raw relation methods and chain like any normal Eloquent relationship. E.g. $customer->bookings()->where('starts_at', '>', new \Carbon\Carbon())->first().

⚠️ Documentation not complete, the package is under developement, and some part may encounter refactoring! ⚠️

Roadmap

Looking for contributors!

The following are a set of limitations to be improved, or feature requests that's looking for contributors to implement, all PRs are welcome 🙂

  • Add the ability to cancel bookings (#43)
  • Complete the bookable availability implementation, and document it (#32, #4)
  • Improve the documentation, and complete missing features, and add a workable example for each.

Changelog

Refer to the Changelog for a full history of the project.

Support

The following support channels are available at your fingertips:

Contributing & Protocols

Thank you for considering contributing to this project! The contribution guide can be found in CONTRIBUTING.md.

Bug reports, feature requests, and pull requests are very welcome.

Security Vulnerabilities

If you discover a security vulnerability within this project, please send an e-mail to [email protected]. All security vulnerabilities will be promptly addressed.

About Rinvex

Rinvex is a software solutions startup, specialized in integrated enterprise solutions for SMEs established in Alexandria, Egypt since June 2016. We believe that our drive The Value, The Reach, and The Impact is what differentiates us and unleash the endless possibilities of our philosophy through the power of software. We like to call it Innovation At The Speed Of Life. That’s how we do our share of advancing humanity.

License

This software is released under The MIT License (MIT).

(c) 2016-2022 Rinvex LLC, Some rights reserved.

laravel-bookings's People

Contributors

dependabot-preview[bot] avatar haringsrob avatar omranic avatar rattone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-bookings's Issues

Cant Pull Repo

Hi,
I cant use this repo in my project, it seems to have something to do with the dev-develop bits in the required section of the composer.json

Please see the error i received below in my terminal:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for rinvex/bookings ^0.0.2 -> satisfiable by rinvex/bookings[v0.0.2].
    - rinvex/bookings v0.0.2 requires rinvex/cacheable dev-develop -> satisfiable by rinvex/cacheable[dev-develop] but these conflict with your requirements or minimum-stability.


Installation failed, deleting ./composer.json.

Any help would be greatly received, many thanks.

Compatible with Laravel 7

Hi, is this resource compatible with Laravel 7?

`mylaptop$compose require rinvex/laravel-bookings
1/3: http://repo.packagist.org/p/provider-latest$d85582671f6aef8a868923ab273c8ad3b9f80d8e051472408d069791b6dd49ce.json
2/3: http://repo.packagist.org/p/provider-2020-04$6e73c81f2134310798c60323af2b1d1b7124edc5849c469d5d7117fd6c509105.json
3/3: http://repo.packagist.org/p/provider-2019$df5759627fed52d18a0a28d474af6fc9139baa9ae79b27b5fe8ea6ddcef8eda1.json
Finished: success: 3, skipped: 0, failure: 0, total: 3
Using version ^3.0 for rinvex/laravel-bookings
./composer.json has been updated
1/3: http://repo.packagist.org/p/provider-latest$d85582671f6aef8a868923ab273c8ad3b9f80d8e051472408d069791b6dd49ce.json
2/3: http://repo.packagist.org/p/provider-2020-04$6e73c81f2134310798c60323af2b1d1b7124edc5849c469d5d7117fd6c509105.json
3/3: http://repo.packagist.org/p/provider-2019$df5759627fed52d18a0a28d474af6fc9139baa9ae79b27b5fe8ea6ddcef8eda1.json
Finished: success: 3, skipped: 0, failure: 0, total: 3
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Conclusion: remove laravel/framework v7.3.0
- Conclusion: don't install laravel/framework v7.3.0
- rinvex/laravel-bookings v3.0.0 requires illuminate/support ^6.0.0 -> satisfiable by laravel/framework[6.x-dev], illuminate/support[6.x-dev, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.10.0, v6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.18.0, v6.18.1, v6.18.10, v6.18.11, v6.18.12, v6.18.13, v6.18.14, v6.18.15, v6.18.16, v6.18.17, v6.18.18, v6.18.19, v6.18.2, v6.18.20, v6.18.21, v6.18.22, v6.18.23, v6.18.24, v6.18.25, v6.18.26, v6.18.3, v6.18.4, v6.18.5, v6.18.6, v6.18.7, v6.18.8, v6.18.9, v6.2.0, v6.3.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0].
- rinvex/laravel-bookings v3.0.1 requires illuminate/support ^6.0.0 -> satisfiable by laravel/framework[6.x-dev], illuminate/support[6.x-dev, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.10.0, v6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.18.0, v6.18.1, v6.18.10, v6.18.11, v6.18.12, v6.18.13, v6.18.14, v6.18.15, v6.18.16, v6.18.17, v6.18.18, v6.18.19, v6.18.2, v6.18.20, v6.18.21, v6.18.22, v6.18.23, v6.18.24, v6.18.25, v6.18.26, v6.18.3, v6.18.4, v6.18.5, v6.18.6, v6.18.7, v6.18.8, v6.18.9, v6.2.0, v6.3.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0].
- rinvex/laravel-bookings v3.0.2 requires illuminate/support ^6.0.0 -> satisfiable by laravel/framework[6.x-dev], illuminate/support[6.x-dev, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.10.0, v6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.18.0, v6.18.1, v6.18.10, v6.18.11, v6.18.12, v6.18.13, v6.18.14, v6.18.15, v6.18.16, v6.18.17, v6.18.18, v6.18.19, v6.18.2, v6.18.20, v6.18.21, v6.18.22, v6.18.23, v6.18.24, v6.18.25, v6.18.26, v6.18.3, v6.18.4, v6.18.5, v6.18.6, v6.18.7, v6.18.8, v6.18.9, v6.2.0, v6.3.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0].
- rinvex/laravel-bookings v3.0.3 requires illuminate/support ^6.0.0 -> satisfiable by laravel/framework[6.x-dev], illuminate/support[6.x-dev, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.10.0, v6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.18.0, v6.18.1, v6.18.10, v6.18.11, v6.18.12, v6.18.13, v6.18.14, v6.18.15, v6.18.16, v6.18.17, v6.18.18, v6.18.19, v6.18.2, v6.18.20, v6.18.21, v6.18.22, v6.18.23, v6.18.24, v6.18.25, v6.18.26, v6.18.3, v6.18.4, v6.18.5, v6.18.6, v6.18.7, v6.18.8, v6.18.9, v6.2.0, v6.3.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0].
- Can only install one of: laravel/framework[6.x-dev, v7.3.0].
- don't install illuminate/support 6.x-dev|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.0.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.0.1|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.0.2|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.0.3|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.0.4|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.1.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.10.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.11.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.12.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.13.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.13.1|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.14.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.15.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.15.1|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.16.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.17.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.17.1|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.1|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.10|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.11|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.12|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.13|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.14|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.15|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.16|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.17|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.18|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.19|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.2|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.20|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.21|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.22|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.23|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.24|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.25|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.26|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.3|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.4|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.5|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.6|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.7|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.8|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.9|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.2.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.3.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.4.1|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.5.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.5.1|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.5.2|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.6.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.6.1|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.6.2|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.7.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.8.0|don't install laravel/framework v7.3.0
- Installation request for laravel/framework (locked at v7.3.0, required as ^7.0) -> satisfiable by laravel/framework[v7.3.0].
- Installation request for rinvex/laravel-bookings ^3.0 -> satisfiable by rinvex/laravel-bookings[v3.0.0, v3.0.1, v3.0.2, v3.0.3].

Installation failed, reverting ./composer.json to its original content.
mylaptop$ COMPOSER_MEMORY_LIMIT=-1 composer require rinvex/laravel-bookings
1/3: http://repo.packagist.org/p/provider-latest$d85582671f6aef8a868923ab273c8ad3b9f80d8e051472408d069791b6dd49ce.json
2/3: http://repo.packagist.org/p/provider-2019$df5759627fed52d18a0a28d474af6fc9139baa9ae79b27b5fe8ea6ddcef8eda1.json
3/3: http://repo.packagist.org/p/provider-2020-04$6e73c81f2134310798c60323af2b1d1b7124edc5849c469d5d7117fd6c509105.json
Finished: success: 3, skipped: 0, failure: 0, total: 3
Using version ^3.0 for rinvex/laravel-bookings
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Conclusion: remove laravel/framework v7.3.0
- Conclusion: don't install laravel/framework v7.3.0
- rinvex/laravel-bookings v3.0.0 requires illuminate/support ^6.0.0 -> satisfiable by laravel/framework[6.x-dev], illuminate/support[6.x-dev, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.10.0, v6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.18.0, v6.18.1, v6.18.10, v6.18.11, v6.18.12, v6.18.13, v6.18.14, v6.18.15, v6.18.16, v6.18.17, v6.18.18, v6.18.19, v6.18.2, v6.18.20, v6.18.21, v6.18.22, v6.18.23, v6.18.24, v6.18.25, v6.18.26, v6.18.3, v6.18.4, v6.18.5, v6.18.6, v6.18.7, v6.18.8, v6.18.9, v6.2.0, v6.3.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0].
- rinvex/laravel-bookings v3.0.1 requires illuminate/support ^6.0.0 -> satisfiable by laravel/framework[6.x-dev], illuminate/support[6.x-dev, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.10.0, v6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.18.0, v6.18.1, v6.18.10, v6.18.11, v6.18.12, v6.18.13, v6.18.14, v6.18.15, v6.18.16, v6.18.17, v6.18.18, v6.18.19, v6.18.2, v6.18.20, v6.18.21, v6.18.22, v6.18.23, v6.18.24, v6.18.25, v6.18.26, v6.18.3, v6.18.4, v6.18.5, v6.18.6, v6.18.7, v6.18.8, v6.18.9, v6.2.0, v6.3.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0].
- rinvex/laravel-bookings v3.0.2 requires illuminate/support ^6.0.0 -> satisfiable by laravel/framework[6.x-dev], illuminate/support[6.x-dev, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.10.0, v6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.18.0, v6.18.1, v6.18.10, v6.18.11, v6.18.12, v6.18.13, v6.18.14, v6.18.15, v6.18.16, v6.18.17, v6.18.18, v6.18.19, v6.18.2, v6.18.20, v6.18.21, v6.18.22, v6.18.23, v6.18.24, v6.18.25, v6.18.26, v6.18.3, v6.18.4, v6.18.5, v6.18.6, v6.18.7, v6.18.8, v6.18.9, v6.2.0, v6.3.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0].
- rinvex/laravel-bookings v3.0.3 requires illuminate/support ^6.0.0 -> satisfiable by laravel/framework[6.x-dev], illuminate/support[6.x-dev, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.10.0, v6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.18.0, v6.18.1, v6.18.10, v6.18.11, v6.18.12, v6.18.13, v6.18.14, v6.18.15, v6.18.16, v6.18.17, v6.18.18, v6.18.19, v6.18.2, v6.18.20, v6.18.21, v6.18.22, v6.18.23, v6.18.24, v6.18.25, v6.18.26, v6.18.3, v6.18.4, v6.18.5, v6.18.6, v6.18.7, v6.18.8, v6.18.9, v6.2.0, v6.3.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0].
- Can only install one of: laravel/framework[6.x-dev, v7.3.0].
- don't install illuminate/support 6.x-dev|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.0.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.0.1|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.0.2|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.0.3|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.0.4|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.1.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.10.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.11.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.12.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.13.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.13.1|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.14.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.15.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.15.1|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.16.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.17.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.17.1|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.1|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.10|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.11|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.12|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.13|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.14|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.15|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.16|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.17|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.18|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.19|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.2|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.20|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.21|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.22|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.23|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.24|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.25|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.26|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.3|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.4|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.5|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.6|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.7|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.8|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.18.9|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.2.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.3.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.4.1|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.5.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.5.1|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.5.2|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.6.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.6.1|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.6.2|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.7.0|don't install laravel/framework v7.3.0
- don't install illuminate/support v6.8.0|don't install laravel/framework v7.3.0
- Installation request for laravel/framework (locked at v7.3.0, required as ^7.0) -> satisfiable by laravel/framework[v7.3.0].
- Installation request for rinvex/laravel-bookings ^3.0 -> satisfiable by rinvex/laravel-bookings[v3.0.0, v3.0.1, v3.0.2, v3.0.3].`

Dead or alive

Hi

Is this package dead or alive ?

If alive, when will a workable example be available ?

Missing functionality that is present in the documentation.

I see some critical methods and services that are present in the documentation but in reality missing from the code base. For example the newPrice() is not available anywhere. I am missing something? Was the documentation written before the actual code?

Can`t publish

I try:
php artisan rinvex:publish:bookings

But error:
Unable to locate publishable resources.

How to fix it?

Many To Many Relation

Hello, first I want to thank you for sharing this great package.

I was wondering if it is possible to have multiple users attached to the same booking. In my use case, I use spatie/permissions to add role functionality to the users, so the same table can have customers, suppliers, and a few levels of admins. The thing is that I would like to, not only associate the booking with the user who is actually making the reservation, but also be able to attach the booking to supplier who is in charge of delivering that booked service.

I went through the code, and I noticed, that you have a polymorphic relation between the bookable resource and the user model that has the trait HasBookings. Would it make sense to change it to a ManyToMany Polymorphic?

Does this makes any sense?

I just forked the package to try make it work for me. If it does, would you care to include this feature in your code?

Best regards.

Test folder missing?

I'm impressed by the extent of this code base, but the test files seem to be missing.

Endless redirection on Booking update

Hello,

I'm trying tu update my Booking object extended from BookableBooking.

Booking::create(...);
works fine.

Retrieving the booking in database
$booking = Booking::find($booking_id);
works fine.

But after that when I try to update

$booking->update([
    'total_paid' => $total_paid
]);

or save

$booking->total_paid = $total_paid;
$booking->save();

I get an endless loop.

DB::table('bookable_bookings')->where('id', $booking_id)->update(['total_paid' => $total_paid]);
works fine but is kinda ugly...

Any idea on what could be going on there or how to fix this please ?

I have issues migrating the php artisan rinvex:migrate:bookings

I'm a laravel newbie, please help me out, After using the composer code for install, i ran into issues during the migration. I got this error and I dont know how to go about it

$ php artisan rinvex:migrate:bookings
Migrate Rinvex Bookings Tables.
Migrating: 2017_06_27_143745_create_bookable_bookings_table

Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access
violation: 1064 You have an error in your SQL syntax; check the manual that cor
responds to your MariaDB server version for the right syntax to use near 'json n
ull, notes text null, created_at timestamp null, updated_at timestam' at l
ine 1 (SQL: create table bookable_bookings (id int unsigned not null auto_in
crement primary key, bookable_type varchar(191) not null, bookable_id bigint
unsigned not null, customer_type varchar(191) not null, customer_id bigint
unsigned not null, starts_at datetime null, ends_at datetime null, canceled _at datetime null, timezone varchar(191) null, price decimal(8, 2) not null
default '0.00', quantity int unsigned not null, total_paid decimal(8, 2) no
t null default '0.00', currency varchar(3) not null, formula text null, opt ions json null, notes text null, created_at timestamp null, updated_at ti
mestamp null, deleted_at timestamp null) default character set utf8mb4 collate
'utf8mb4_unicode_ci')

at C:\Users\USER\aquapool\vendor\laravel\framework\src\Illuminate\Database\Con
nection.php:664
660| // If an exception occurs when attempting to run a query, we'll
format the error
661| // message to include the bindings with SQL, which will make th
is exception a
662| // lot more helpful to the developer instead of just the databa
se's errors.
663| catch (Exception $e) {

664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|

Exception trace:

1 PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1064 Yo
u have an error in your SQL syntax; check the manual that corresponds to your Ma
riaDB server version for the right syntax to use near 'json null, notes text n
ull, created_at timestamp null, updated_at timestam' at line 1")
C:\Users\USER\aquapool\vendor\laravel\framework\src\Illuminate\Database\Co
nnection.php:452

2 PDO::prepare("create table bookable_bookings (id int unsigned not null
auto_increment primary key, bookable_type varchar(191) not null, bookable_id bigint unsigned not null, customer_type varchar(191) not null, customer_id
bigint unsigned not null, starts_at datetime null, ends_at datetime null, canceled_at datetime null, timezone varchar(191) null, price decimal(8, 2)
not null default '0.00', quantity int unsigned not null, total_paid decimal(
8, 2) not null default '0.00', currency varchar(3) not null, formula text nu
ll, options json null, notes text null, created_at timestamp null, update d_at timestamp null, deleted_at timestamp null) default character set utf8mb4
collate 'utf8mb4_unicode_ci'")
C:\Users\USER\aquapool\vendor\laravel\framework\src\Illuminate\Database\Co
nnection.php:452

Please use the argument -v to see more details.

Laravel 5.7+ support

Hi, I am wondering if this package can be installed in Laravel 5.7*.
I was trying to install it, but it's not satisfiable on Laravel 5.7.

Can not create newBooking() and validation does not throw an error

Laravel: 6.4
laravel-bookings: v3.0.1

In this code below will not work
Bookable trait

public function newBooking(Model $customer, string $startsAt, string $endsAt): BookableBooking
    {
        return $this->bookings()->create([
            'bookable_id' => static::getKey(),
            'bookable_type' => static::getMorphClass(),
            'customer_id' => $customer->getKey(),
            'customer_type' => $customer->getMorphClass(),
            'starts_at' => (new Carbon($startsAt))->toDateTimeString(),
            'ends_at' => (new Carbon($endsAt))->toDateTimeString(),
        ]);
    }

because it is missing 4 required properties. Here is the sample ones it needs

price' => 1,
 'quantity' => 1,
 'total_paid' => 1,
 'currency' => 'EUR',

They are set to required Bookablebookings and there is a validation trait that should warn the user that the information is not provided so show and error.
Bookablebookings

price' => 'required|numeric',
 'quantity' => 'required|integer',
 'total_paid' => 'required|numeric',
 'currency' => 'required|alpha|size:3',

Only issue though is it does not throw an error that the information is not provided even though this variable is set to true below. If it set it to false i find out that i am missing those 4 properties.
Bookablebookings

/**
     * Whether the model should throw a
     * ValidationException if it fails validation.
     *
     * @var bool
     */
    protected $throwValidationExceptions = true;

Once the 4 properties are provided then the booking is created.

Booking not validating availability

I was looking through the package and I dont understand how the availability of the bookable objects are validated. Do you have an example of how we can validate that if a model has an availability object created, the booking dates must be between the availability object range in order to be created?
I also dont understand why the from and to columns in the availability model are strings and not dates

how should we validate that bookings are between the availability objects when the date fields are not dates?
$serviceBooking = new \App\Models\Availability();
$serviceBooking->make(['range' => 'monday', 'from' => '08:00 am', 'to' => '12:30 pm', 'is_bookable' => true]) ->bookable()->associate($merchant) ->save();
$merchant->newBooking($user, '2019-07-01 12:44:12', '2019-07-01 14:30:11');

This booking should not be created because the date range is not with the available date range. However both objects are created and stored.
thank you

Cannot create booking availability: Return value of App\BookingEvent::newAvailability() must be an instance of Rinvex\Bookings\Models\BookingAvailability, instance of Rinvex\Bookings\Models\BookingRate returned

Hi,

I am trying to create booking availability following the example given in the docs. But i keep getting this error:
"Type error: Return value of App\BookingEvent::newAvailability() must be an instance of Rinvex\Bookings\Models\BookingAvailability, instance of Rinvex\Bookings\Models\BookingRate returned"

Here is my small bit of code below:

$event = BookingEvent::find(1);
$event->newAvailability('thu', '09:00 am', '05:00 pm', 10.5);

Here is my BookingEvent class:

<?php

namespace App;

use Rinvex\Bookings\Traits\Bookable;
use Illuminate\Database\Eloquent\Model;

class BookingEvent extends Model
{
	use Bookable;

	/**
	* @param 	$request Illuminate\Http\Request
	* @access 	public
	* @return 	String
	*/
	public function getBookings(Request $request)
	{
		
	}
}

Thank you.

Does this package support Laravel 7

Hi,

I am confused as to what version of Laravel this package supports as it does not seem to be mentioned within the README file. When installing on 7.18.0 I get the following error:

image

Thank you in advance.

Dependabot can't resolve your PHP dependency files

Dependabot can't resolve your PHP dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - Root composer.json requires rinvex/laravel-support ^5.0.0 -> satisfiable by rinvex/laravel-support[v5.0.0].
    - Conclusion: don't install illuminate/console v8.0.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.0.1 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.0.2 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.0.3 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.0.4 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.1.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.2.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.3.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.4.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.5.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.6.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.7.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.7.1 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.8.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.9.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.10.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.11.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.11.1 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.11.2 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.12.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.12.1 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.12.2 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.12.3 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.13.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.14.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.15.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.16.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.16.1 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.17.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.17.2 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.18.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.18.1 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.19.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.20.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.20.1 (conflict analysis result)
    - rinvex/laravel-support v5.0.0 requires felixkiss/uniquewith-validator ^3.4.0 -> satisfiable by felixkiss/uniquewith-validator[3.4.0].
    - illuminate/console 9.x-dev is an alias of illuminate/console dev-master and thus requires it to be installed too.
    - Conclusion: don't install illuminate/console dev-master (conflict analysis result)
    - felixkiss/uniquewith-validator 3.4.0 requires illuminate/support ^5.5|^6.0|^7.0 -> satisfiable by laravel/framework[v5.8.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev].
    - Only one of these can be installed: laravel/framework[v5.8.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev], illuminate/console[dev-master, v8.0.0, ..., 8.x-dev]. laravel/framework replaces illuminate/console and thus cannot coexist with it.
    - Root composer.json requires illuminate/console ^8.0.0 || ^9.0.0 -> satisfiable by illuminate/console[v8.0.0, ..., 8.x-dev, 9.x-dev (alias of dev-master)].

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Return value of App\Room::newBooking() must be an instance of Rinvex\Bookings\Models\BookableBooking, instance of App\Booking returned

Hi,

I am getting this issue

Return value of App\Room::newBooking() must be an instance of Rinvex\Bookings\Models\BookableBooking, instance of App\Booking returned

Testing using this code in my controller

$customer = auth()->user();
  $room->newBooking($customer, '2017-07-05 12:44:12', '2017-07-10 18:30:11');

Please point me in the right direction

Room Model


namespace App;


use Rinvex\Bookings\Traits\Bookable;
use Illuminate\Database\Eloquent\Model;

class Room extends Model
{
    //
    use Bookable;

     /**
     * Get the booking model name.
     *
     * @return string
     */
    public static function getBookingModel(): string
    {
        return Booking::class;
    }

    /**
     * Get the rate model name.
     *
     * @return string
     */
    public static function getRateModel(): string
    {
        return Rate::class;
    }

    /**
     * Get the availability model name.
     *
     * @return string
     */
    public static function getAvailabilityModel(): string
    {
        return Availability::class;
    }
}

User Controller


namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Rinvex\Bookings\Traits\HasBookings;

class User extends Authenticatable
{
    use Notifiable;
    use HasBookings;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

       /**
     * Get the booking model name.
     *
     * @return string
     */
    public static function getBookingModel(): string
    {
        return Booking::class;
    }
}

Dependabot can't resolve your PHP dependency files

Dependabot can't resolve your PHP dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - rinvex/laravel-support v5.0.0 requires php ^7.4.0 -> your php version (8.0.0; overridden via config.platform, actual: 7.4.16) does not satisfy that requirement.
    - rinvex/laravel-support[v5.0.1, ..., v5.0.12] require spatie/laravel-schemaless-attributes ^1.8.0 -> found spatie/laravel-schemaless-attributes[1.8.0, 1.8.1, 1.8.2, 1.8.3] but it conflicts with your root composer.json require (^2.0.0).
    - Root composer.json requires rinvex/laravel-support ^5.0.0 -> satisfiable by rinvex/laravel-support[v5.0.0, ..., v5.0.12].

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Availability documentation

I understand the documentation isn't complete, but could someone help me by explaining how you can create availabilities and check for clashes in dates?

Thanks!

Migrations override

Hi,
I tried to override migrations by publishing them:
php artisan rinvex:publish:bookings

The files were copied to database/migrations/rinvex/laravel-bookings where I was able to edit them.

But
php artisan migrate
keeps looking for the original files in vendor/rinvex/...

Could you please tell me what I missed here?

Best regards

Dependabot can't resolve your PHP dependency files

Dependabot can't resolve your PHP dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - Root composer.json requires rinvex/laravel-support ^5.0.0 -> satisfiable by rinvex/laravel-support[v5.0.0].
    - Conclusion: don't install illuminate/console v8.0.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.0.1 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.0.2 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.0.3 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.0.4 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.1.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.2.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.3.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.4.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.5.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.6.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.7.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.7.1 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.8.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.9.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.10.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.11.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.11.1 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.11.2 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.12.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.12.1 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.12.2 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.12.3 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.13.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.14.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.15.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.16.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.16.1 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.17.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.17.2 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.18.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.18.1 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.19.0 (conflict analysis result)
    - rinvex/laravel-support v5.0.0 requires felixkiss/uniquewith-validator ^3.4.0 -> satisfiable by felixkiss/uniquewith-validator[3.4.0].
    - illuminate/console 9.x-dev is an alias of illuminate/console dev-master and thus requires it to be installed too.
    - Conclusion: don't install illuminate/console dev-master (conflict analysis result)
    - felixkiss/uniquewith-validator 3.4.0 requires illuminate/support ^5.5|^6.0|^7.0 -> satisfiable by laravel/framework[v5.8.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev].
    - Only one of these can be installed: laravel/framework[v5.8.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev], illuminate/console[dev-master, v8.0.0, ..., 8.x-dev]. laravel/framework replaces illuminate/console and thus cannot coexist with it.
    - Root composer.json requires illuminate/console ^8.0.0 || ^9.0.0 -> satisfiable by illuminate/console[v8.0.0, ..., 8.x-dev, 9.x-dev (alias of dev-master)].

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Composer dependency problems for Laravel 8 & PHP 8

Hi @Omranic thanks for your work.

I've been trying to install this into my Laravel 8 project without success. I get the following errors from composer

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - rinvex/laravel-support v5.0.1 requires felixkiss/uniquewith-validator ^3.4.0 -> satisfiable by felixkiss/uniquewith-validator[3.4.0].
    - rinvex/laravel-support v5.0.3 requires rinvex/tmp-watson-validating ^6.0.0 -> satisfiable by rinvex/tmp-watson-validating[6.0.0, v6.0.1, 6.0.2, 6.0.3].
    - rinvex/laravel-support v5.0.2 requires rinvex/tmp-felixkiss-uniquewith-validator 3.4.0 -> satisfiable by rinvex/tmp-felixkiss-uniquewith-validator[3.4.0].
    - rinvex/laravel-bookings v5.0.0 requires php ^7.4.0 -> your php version (8.0.1) does not satisfy that requirement.
    - rinvex/laravel-support v5.0.0 requires php ^7.4.0 -> your php version (8.0.1) does not satisfy that requirement.
    - felixkiss/uniquewith-validator 3.4.0 requires php ^7.1.3 -> your php version (8.0.1) does not satisfy that requirement.
    - rinvex/tmp-felixkiss-uniquewith-validator 3.4.0 requires php ^7.1.3 -> your php version (8.0.1) does not satisfy that requirement.
    - rinvex/tmp-watson-validating[6.0.0, ..., 6.0.2] require php ^7.3 -> your php version (8.0.1) does not satisfy that requirement.
    - rinvex/tmp-watson-validating 6.0.3 requires php ^7.3 || v8.0.0 -> your php version (8.0.1) does not satisfy that requirement.
    - rinvex/laravel-bookings v5.0.1 requires rinvex/laravel-support ^5.0.0 -> satisfiable by rinvex/laravel-support[v5.0.0, v5.0.1, v5.0.2, v5.0.3].
    - Root composer.json requires rinvex/laravel-bookings ^5.0 -> satisfiable by rinvex/laravel-bookings[v5.0.0, v5.0.1].

Installation failed, reverting ./composer.json to its original content.

This happens even on a fresh Laravel 8. I've tried to install laravel-support manually (explicitly specifying v5.0.3) without success and it seems to boil down to the fact that I'm running php 8.0.1 instead of 8.0.0.

  Problem 1
    - rinvex/tmp-watson-validating[6.0.0, ..., 6.0.2] require php ^7.3 -> your php version (8.0.1) does not satisfy that requirement.
    - rinvex/tmp-watson-validating 6.0.3 requires php ^7.3 || v8.0.0 -> your php version (8.0.1) does not satisfy that requirement.
    - rinvex/laravel-support v5.0.3 requires rinvex/tmp-watson-validating ^6.0.0 -> satisfiable by rinvex/tmp-watson-validating[6.0.0, v6.0.1, 6.0.2, 6.0.3].
    - Root composer.json requires rinvex/laravel-support ^5.0.3 -> satisfiable by rinvex/laravel-support[v5.0.3].

Is there any reason for specifying 8.0.0 or would you be able to adjust the PHP require to ^8.0 as it is blocking me from using the package without downgrading PHP entirely.

Thanks

Documentation

The project sounds cool but too bad, I tried using this in my scenario and I feel like the documentation is lacking something I don't know what exactly but when I just do as per the documentation I face many errors I don't know why tried fixing a few but still more error. if by any chance you could point to me where to read more of this or a working example.

Dependabot can't resolve your PHP dependency files

Dependabot can't resolve your PHP dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - illuminate/console 9.x-dev is an alias of illuminate/console dev-master and thus requires it to be installed too.
    - Conclusion: don't install illuminate/console dev-master (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.0.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.0.1 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.0.2 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.0.3 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.0.4 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.1.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.2.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.3.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.4.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.5.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.6.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.7.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.7.1 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.8.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.9.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.10.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.11.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.11.1 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.11.2 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.12.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.12.1 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.12.2 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.12.3 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.13.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.14.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.15.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.16.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.16.1 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.17.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.17.2 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.18.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.18.1 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.19.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.20.0 (conflict analysis result)
    - Conclusion: don't install illuminate/console v8.20.1 (conflict analysis result)
    - illuminate/validation[v5.5.0, ..., 5.5.x-dev] require illuminate/container 5.5.* -> found illuminate/container[v5.5.0, ..., 5.5.x-dev] but it conflicts with your root composer.json require (^8.0.0 || ^9.0.0).
    - illuminate/validation[v5.6.0, ..., 5.6.x-dev] require illuminate/container 5.6.* -> found illuminate/container[v5.6.0, ..., 5.6.x-dev] but it conflicts with your root composer.json require (^8.0.0 || ^9.0.0).
    - illuminate/validation[v5.7.0, ..., 5.7.x-dev] require illuminate/container 5.7.* -> found illuminate/container[v5.7.0, ..., 5.7.x-dev] but it conflicts with your root composer.json require (^8.0.0 || ^9.0.0).
    - rinvex/laravel-support v5.0.2 requires rinvex/tmp-felixkiss-uniquewith-validator 3.4.0 -> satisfiable by rinvex/tmp-felixkiss-uniquewith-validator[3.4.0].
    - rinvex/laravel-support[v5.0.0, ..., v5.0.1] require felixkiss/uniquewith-validator ^3.4.0 -> satisfiable by felixkiss/uniquewith-validator[3.4.0].
    - rinvex/tmp-felixkiss-uniquewith-validator 3.4.0 requires illuminate/validation ^5.5|^6.0|^7.0 -> satisfiable by laravel/framework[v5.8.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev], illuminate/validation[v5.5.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev].
    - illuminate/validation[v7.0.0, ..., 7.x-dev] require illuminate/translation ^7.0 -> satisfiable by laravel/framework[v7.0.0, ..., 7.x-dev], illuminate/translation[v7.0.0, ..., 7.x-dev].
    - illuminate/translation[v7.0.0, ..., 7.x-dev] require illuminate/support ^7.0 -> satisfiable by laravel/framework[v7.0.0, ..., 7.x-dev].
    - felixkiss/uniquewith-validator 3.4.0 requires illuminate/support ^5.5|^6.0|^7.0 -> satisfiable by laravel/framework[v5.8.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev].
    - illuminate/validation[v6.0.0, ..., 6.x-dev] require illuminate/translation ^6.0 -> satisfiable by laravel/framework[v6.0.0, ..., 6.x-dev], illuminate/translation[v6.0.0, ..., 6.x-dev].
    - illuminate/translation[v6.0.0, ..., 6.x-dev] require illuminate/support ^6.0 -> satisfiable by laravel/framework[v6.0.0, ..., 6.x-dev].
    - illuminate/validation[v5.8.0, ..., 5.8.x-dev] require illuminate/translation 5.8.* -> satisfiable by laravel/framework[v5.8.0, ..., 5.8.x-dev], illuminate/translation[v5.8.0, ..., 5.8.x-dev].
    - illuminate/translation[v5.8.0, ..., 5.8.x-dev] require illuminate/support 5.8.* -> satisfiable by laravel/framework[v5.8.0, ..., 5.8.x-dev].
    - Only one of these can be installed: laravel/framework[v5.8.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev], illuminate/console[dev-master, v8.0.0, ..., 8.x-dev]. laravel/framework replaces illuminate/console and thus cannot coexist with it.
    - Root composer.json requires illuminate/console ^8.0.0 || ^9.0.0 -> satisfiable by illuminate/console[v8.0.0, ..., 8.x-dev, 9.x-dev (alias of dev-master)].
    - Root composer.json requires rinvex/laravel-support ^5.0.0 -> satisfiable by rinvex/laravel-support[v5.0.0, v5.0.1, v5.0.2].

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Date based rates

Thanks for sharing this package!

I looked through the code, but couldn't find an answer... Is there a way to set booking rates based on other things than quantity of a specific unit?

I.e. to have a different rate for a weekend / midweek etc.?

can't install, getting warnings

im getting these errors, how do i fix it?

composer require rinvex/laravel-bookings
Using version ^1.0 for rinvex/laravel-bookings
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove laravel/framework v5.8.18
    - Conclusion: don't install laravel/framework v5.8.18
    - rinvex/laravel-bookings v1.0.0 requires illuminate/database ~5.7.0 -> satisfiable by laravel/framework[5.7.x-dev], illuminate/database[5.7.17, 5.7.18, 5.7.19, 5.7.x-dev, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.15, v5.7.2, v5.7.20, v5.7.21, v5.7.22, v5.7.23, v5.7.26, v5.7.27, v5.7.28, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9].
    - rinvex/laravel-bookings v1.0.1 requires illuminate/database ~5.7.0 -> satisfiable by laravel/framework[5.7.x-dev], illuminate/database[5.7.17, 5.7.18, 5.7.19, 5.7.x-dev, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.15, v5.7.2, v5.7.20, v5.7.21, v5.7.22, v5.7.23, v5.7.26, v5.7.27, v5.7.28, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9].
    - Can only install one of: laravel/framework[5.7.x-dev, v5.8.18].
    - don't install illuminate/database 5.7.17|don't install laravel/framework v5.8.18
    - don't install illuminate/database 5.7.18|don't install laravel/framework v5.8.18
    - don't install illuminate/database 5.7.19|don't install laravel/framework v5.8.18
    - don't install illuminate/database 5.7.x-dev|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.0|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.1|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.10|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.11|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.15|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.2|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.20|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.21|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.22|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.23|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.26|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.27|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.28|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.3|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.4|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.5|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.6|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.7|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.8|don't install laravel/framework v5.8.18
    - don't install illuminate/database v5.7.9|don't install laravel/framework v5.8.18
    - Installation request for laravel/framework (locked at v5.8.18, required as 5.8.*) -> satisfiable by laravel/framework[v5.8.18].
    - Installation request for rinvex/laravel-bookings ^1.0 -> satisfiable by rinvex/laravel-bookings[v1.0.0, v1.0.1].


Installation failed, reverting ./composer.json to its original content.

Documentation

From the README

Usage

Rinvex Bookings has been specially made for Eloquent and simplicity has been taken very serious as in any other Laravel related aspect.

Add bookable functionality to your resource model

To add bookable functionality to your resource model just use the \Rinvex\Bookings\Traits\Bookable trait like this:

namespace App\Models;

use Rinvex\Bookings\Traits\Bookable;
use Illuminate\Database\Eloquent\Model;

class Room extends Model
{
    use Bookable;
}

That's it, you only have to use that trait in your Room model! Now your rooms will be bookable.

Add bookable functionality to your customer model

To add bookable functionality to your customer model just use the \Rinvex\Bookings\Traits\HasBookings trait like this:

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Rinvex\Bookings\Traits\HasBookings;

class Customer extends Model
{
    use HasBookings;
}

Again, that's all you need to do! Now your Customer model can book resources.


That's not all you need to do. It would be helpful if the abstract functions in these traits were documented and explained, i.e. getBookingModel, getRateModel, getAvailabilityModel. Overall the documentation is somewhat sparse.

I am still exploring this package but it seems like it will be a good fit for my application, but the setup was a bit confusing.

Unable to create BookableRate, Watson: the given data was invalid

"rinvex/laravel-bookings": "^2.1"
"laravel/framework": "5.8.*"

Error: Watson/Validating/ValidationException with message 'The given data was invalid.'

php artisan tinker

$room = \App\Room::find(1);
$room->newRate('15', '^', 2, $room);

App\Room

<?php

namespace App;

use Rinvex\Bookings\Traits\Bookable;
use Illuminate\Database\Eloquent\Model;
use App\BookableRate;

class Room extends Model
{
    use Bookable;

public function newRate($percent, $operator, $unit, $bookable): BookableRate
    {
        $rate = new BookableRate;
        $rate->make(['percentage' => $percent, 'operator' => $operator, 'amount' => $unit])
            ->bookable()->associate($bookable)
            ->save();
        return $rate;
    }
}

App\BookableRate

<?php

namespace App;

use Rinvex\Bookings\Models\BookableRate as RinvexBookableRate;

class BookableRate extends RinvexBookableRate
{
    protected $table = 'bookable_rates';

}

Undefined index 0 in BookableBooking boot method

hi, just getting started with this package but i'm facing the error in the title.
It seems that in the boot method

protected static function boot()
    {
        parent::boot();
        static::validating(function (self $bookableAvailability) {
            [$price, $formula, $currency] = is_null($bookableAvailability->price)
                ? $bookableAvailability->calculatePrice($bookableAvailability->bookable, $bookableAvailability->starts_at, $bookableAvailability->ends_at) : [$bookableAvailability->price, $bookableAvailability->formula, $bookableAvailability->currency];
            $bookableAvailability->currency = $currency;
            $bookableAvailability->formula = $formula;
            $bookableAvailability->price = $price;
        });
    }

The calculatePrice function is returning an associative array, while php is expecting an indexed array when assigning the result of the calculatePrice function

[$price, $formula, $currency] = [...]$bookableAvailability->calculatePrice([...])

.. Am i missing something ?

How to cancel booking

I set canceled_at to now, but it occurs error when saving.
Without any change, saving BookableBooking model occurs error.
It seems 'options' member, It is null, but error is 'The options must be an array'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.