Download the PHP package shayanys/lara-reserve without Composer

On this page you can find all versions of the php package shayanys/lara-reserve. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package lara-reserve

Lara Reserve

Lara Reserve license Lara Reserve size Lara Reserve version

Lara Reserve Is a Laravel Package To Adds a Reservation feature to the laravel models.

Installation

To Install Lara Reserve Run Following Command:

and then run Migrations By:

Usage

Initialize Models to Use Lara Reserve

To Add Lara Reserve Feature To Models, Your Models Should Implement ReservableInterface And use Reservable Trait. And the Model Is Ready For Reserve By the Customer. And If Your Model Is a Customer, e.g. User model (Which Can Reserve Reservables) Should Implement CustomerInterface And use Customer Trait.

Example:

Reservable Model:

Reservable Model:

Reservations

Call reserve Method From Customer

you can reserve a reservable for a customer by reserve method of a customer model:

in the above example, $reservable will reserve for $customer.

Parameters

  1. reservable you want to reserve for customer
  2. the desired date for the reservation
  3. the desired time for the reservation in H:i:s format
  4. the desired date for the end reservation - optional
  5. the desired time for the end reservation in H:i:s format - optional
  6. additional details for the reservation - optional

Call reserveForCustomer Method From Reservable

In the above example, like the previous example, $reservable will reserve for $customer. In the reserveFroCustomer

Parameters

  1. the customer would you like to make a reservation for
  2. the desired date for the reservation
  3. the desired time for the reservation in H:i:s format
  4. the desired date for the end reservation - optional
  5. the desired time for the end reservation in H:i:s format - optional
  6. additional details for the reservation - optional

Call reserveWithoutCustomer Method From Reservable

With this method, you can reserve a reservable without a customer.

Parameters

  1. array of the reservation details
  2. the desired date for the reservation
  3. the desired time for the reservation in H:i:s format
  4. the desired date for the end reservation - optional
  5. the desired time for the end reservation in H:i:s format - optional

Max allowed reserves

Setting the maximum possible number of reservations on one date and time.

to set maximum allowed reserve in one date you should add max_allowed_reserves column to your reservable table in database:

you can set max_allowed_reserves column of a reservable by calling maxAllowedReserves from reservable: this method get $max to set it as value of max_allowed_reserves column.

if you want to get the max_allowed_reserves from reservable you can do this:

returns null if not exists or its null in database.

Is available

isAvailable method can call from reservable and get two arguments date and optional time; and returns is that reservable available in passed date and time (the time default is 00:00:00).

This code returns true if max_allowed_reserves is less than count of all reserves in 2023-05-1 17:00:00; otherwise returns false.

withoutCheckAvailability and withCheckAvailability

if you don't want to check the availability for some reasons you can use withoutCheckAvailability method:

this code will bypass the check availability.

also you can set reservable to don't check availability by default:

other way to modify this is to modify shouldCheckAvailability method:

this will don't check availability by default. if you want check availability when you set checkAvailability property in constructor to false you should do this:

this will check availability and then reserve.

Get Reserves

you can get reserves from customer or reservable.

activeReserves

the activeReserves method return a MorphMany relation you can call get method to get the collection of reserves; you can also call paginate method.

allReserves

the allReserves method return a MorphMany relation you can call get method to get the collection of reserves; you can also call paginate method.

startedReserves

the startedReserves method return a MorphMany relation you can call get method to get the collection of reserves; you can also call paginate method.

endedReserves

the endedReserves method return a MorphMany relation you can call get method to get the collection of reserves; you can also call paginate method.

License

Freely distributable under the terms of the MIT license.


All versions of lara-reserve with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package shayanys/lara-reserve contains the following files

Loading the files please wait ....