Documentation

BookingVehicleRepository extends Repository

Table of Contents

PAGINATION_LIMIT  = 15
RESPONSE_STATUS_ERROR  = 'error'
RESPONSE_STATUS_FAIL  = 'fail'
RESPONSE_STATUS_SUCCESS  = 'success'
$agencyRepo  : mixed
$model  : mixed
Model var
$repo  : mixed
Repo var
__construct()  : mixed
all()  : array<string|int, mixed>
Get all instances of model
allCustom()  : string
cleanNullValues()  : null
Change null values and put string("")
create()  : object
Create a new record in the database
delete()  : bool
It soft-deletes a record from the database
deleteCustom()  : null
ensureHttp400Code()  : string
Return a extension from mimetype
finishRentalAgreement()  : mixed
firstOrCreate()  : object
Retrieves first element of the database. If it doesn't exists, it creates it before returning it.
firstOrNew()  : object
Retrieves first element of the database. If it doesn't exists, it instanciates it before returning it.
forceDelete()  : bool
It definitely removes a record from the database
generateBookingCode()  : string
Write code on Method
getBookingFromBroker()  : array<string|int, mixed>
getConcatString()  : string
Concatenate string to make it compatible with SQLite
getErrorResponse()  : array<string|int, mixed>
Return all an array of errors like validation in one format
getFailResponse()  : array<string|int, mixed>
Return all an array of errors like validation in one format
getModel()  : Model
Get the associated model
getSuccessResponse()  : array<string|int, mixed>
Return all an array of errors like validation in one format
microsecondsToSeconds()  : array<string|int, mixed>
Return all an array of errors like validation in one format
mime2ext()  : string
Return a extension from mimetype
notifyCustomer()  : string
orderQuery()  : null
Destroy record from the database
paginate()  : Model
publicStore()  : string
returnBookingDocument()  : BookingDocument
schedulesOffice()  : string
sendMail()  : bool
Send an email
setModel()  : mixed
Set the associated model
show()  : object
Show the record with the given id
showAdditionalCostsPdf()  : mixed
showCustom()  : object
showGeneralConditionsPdf()  : mixed
showRentalAgreement()  : mixed
showRentalAgreementPdf()  : mixed
showVehicleDocuments()  : mixed
showWith()  : Model
Eager load database relationships
signAdditionalCostsPdf()  : mixed
signGeneralConditionsPdf()  : mixed
storeCustom()  : string
storeRentalAgreement()  : mixed
update()  : object
Updates a record in the database
updateCustom()  : string
createBookingForBroker()  : mixed
createBookingFromBrokerBackoffice()  : mixed
createOrUpdateCustomer()  : mixed
loadAdditionalCostsPdf()  : mixed
loadFinishRentalAgreementPdf()  : mixed
loadGeneralConditionsPdf()  : mixed
loadRentalAgreementPdf()  : mixed
storeAdditionalCostsPdf()  : BookingDocument
storeFinishRentalPdf()  : mixed
storeGeneralConditionsPdf()  : BookingDocument
storePaymentTransaction()  : mixed
storeRedsysTransaction()  : mixed
storeRentalAgreementPdf()  : void
updateBookingFromBrokerBackoffice()  : mixed
updateComment()  : void

Constants

PAGINATION_LIMIT

public mixed PAGINATION_LIMIT = 15

RESPONSE_STATUS_ERROR

public mixed RESPONSE_STATUS_ERROR = 'error'

RESPONSE_STATUS_FAIL

public mixed RESPONSE_STATUS_FAIL = 'fail'

RESPONSE_STATUS_SUCCESS

public mixed RESPONSE_STATUS_SUCCESS = 'success'

Properties

Methods

all()

Get all instances of model

public all() : array<string|int, mixed>
Return values
array<string|int, mixed>

allCustom()

public allCustom(mixed $data, mixed $agency_id, mixed $booking_id) : string
Parameters
$data : mixed
$agency_id : mixed
$booking_id : mixed
Tags
desc

Return a database records

Return values
string

cleanNullValues()

Change null values and put string("")

public cleanNullValues(array<string|int, mixed> &$data[, array<string|int, mixed> $exceptions = [] ]) : null
Parameters
$data : array<string|int, mixed>
  • Array with parameters
$exceptions : array<string|int, mixed> = []
  • Array with exceptions keys
Return values
null

create()

Create a new record in the database

public create(array<string|int, mixed> $data) : object
Parameters
$data : array<string|int, mixed>
  • Data of the object that we want to create.
Tags
throws
Exception
Return values
object

delete()

It soft-deletes a record from the database

public delete(array<string|int, mixed> $data, int $id) : bool
Parameters
$data : array<string|int, mixed>
$id : int
  • Id of the object that we want to remove.
Tags
throws
Exception
Return values
bool
  • Success or fail

deleteCustom()

public deleteCustom(array<string|int, mixed> $data,  $agency_id,  $booking_id, int $id) : null
Parameters
$data : array<string|int, mixed>

Data that should be updated

$agency_id :

User agency id

$booking_id :

Booking id to update

$id : int
  • Id of the vehicle that we want to delete.
Tags
desc

Delete record from the database

throws
ValidationException
Return values
null

ensureHttp400Code()

Return a extension from mimetype

public ensureHttp400Code(mixed $code) : string
Parameters
$code : mixed
Return values
string

finishRentalAgreement()

public finishRentalAgreement(array<string|int, mixed> $data, mixed $agency_id, mixed $booking_id) : mixed
Parameters
$data : array<string|int, mixed>
$agency_id : mixed
$booking_id : mixed
Return values
mixed

firstOrCreate()

Retrieves first element of the database. If it doesn't exists, it creates it before returning it.

public firstOrCreate(array<string|int, mixed> $data) : object
Parameters
$data : array<string|int, mixed>
  • Data of the object that we want to create.
Tags
throws
Exception
Return values
object

firstOrNew()

Retrieves first element of the database. If it doesn't exists, it instanciates it before returning it.

public firstOrNew(array<string|int, mixed> $data) : object
Parameters
$data : array<string|int, mixed>
  • Data of the object that we want to create.
Tags
throws
Exception
Return values
object

forceDelete()

It definitely removes a record from the database

public forceDelete(array<string|int, mixed> $data, int $id) : bool
Parameters
$data : array<string|int, mixed>
$id : int
  • Id of the object that we want to remove.
Tags
throws
Exception
Return values
bool
  • Success or fail

generateBookingCode()

Write code on Method

public generateBookingCode() : string
Return values
string

getBookingFromBroker()

public getBookingFromBroker(mixed $booking) : array<string|int, mixed>
Parameters
$booking : mixed
Return values
array<string|int, mixed>

getConcatString()

Concatenate string to make it compatible with SQLite

public getConcatString( $firstField,  $secondField[,  $concatCharacter = ' ' ]) : string
Parameters
$firstField :

to concat

$secondField :

to concat

$concatCharacter : = ' '

Character used to join fields, default is space

Return values
string

getErrorResponse()

Return all an array of errors like validation in one format

public getErrorResponse(mixed $message[, mixed $code = null ]) : array<string|int, mixed>
Parameters
$message : mixed
$code : mixed = null
Return values
array<string|int, mixed>

getFailResponse()

Return all an array of errors like validation in one format

public getFailResponse(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>
  • Array with parameters
Return values
array<string|int, mixed>

getModel()

Get the associated model

public getModel() : Model
Return values
Model

$model - A specific model

getSuccessResponse()

Return all an array of errors like validation in one format

public getSuccessResponse([array<string|int, mixed> $data = "" ]) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed> = ""
  • Array with parameters
Return values
array<string|int, mixed>

microsecondsToSeconds()

Return all an array of errors like validation in one format

public microsecondsToSeconds(mixed $microseconds) : array<string|int, mixed>
Parameters
$microseconds : mixed
Return values
array<string|int, mixed>

mime2ext()

Return a extension from mimetype

public mime2ext(string $mime) : string
Parameters
$mime : string
  • String with mimetype
Return values
string

notifyCustomer()

public notifyCustomer(array<string|int, mixed> $data) : string
Parameters
$data : array<string|int, mixed>
Tags
desc

Sends email to a client with BookingVehicle reservation code.

Return values
string

orderQuery()

Destroy record from the database

public orderQuery(mixed &$query, array<string|int, mixed> $params) : null
Parameters
$query : mixed
$params : array<string|int, mixed>
  • Array with the pagination params
Return values
null

paginate()

public paginate(mixed $paginationLimit) : Model
Parameters
$paginationLimit : mixed
Tags
desc

Get items with pagination

Return values
Model

$model - N instances of mode

publicStore()

public publicStore(array<string|int, mixed> $data) : string
Parameters
$data : array<string|int, mixed>
Tags
desc

Create a new record in the database

Return values
string

returnBookingDocument()

public returnBookingDocument(mixed $booking, mixed $type, mixed $description, mixed $publicPath, mixed $fileName, mixed $pdf) : BookingDocument
Parameters
$booking : mixed
$type : mixed
$description : mixed
$publicPath : mixed
$fileName : mixed
$pdf : mixed
Return values
BookingDocument

schedulesOffice()

public schedulesOffice( $office, mixed $lang) : string
Parameters
$office :
  • office Object.
$lang : mixed
Tags
desc

Take schedules data from a office.

Return values
string

sendMail()

Send an email

public sendMail( $mail, string $toEmail[, string $bccEmail = null ]) : bool
Parameters
$mail :
  • Mailable extended class to send
$toEmail : string
  • Delivery address
$bccEmail : string = null
  • Black carbon copy address
Return values
bool

setModel()

Set the associated model

public setModel(Model $model) : mixed
Parameters
$model : Model
  • A specific model
Return values
mixed

show()

Show the record with the given id

public show(int $id) : object
Parameters
$id : int
  • Id of the object that we want to show.
Return values
object

showAdditionalCostsPdf()

public showAdditionalCostsPdf(mixed $agency_id, mixed $booking_id) : mixed
Parameters
$agency_id : mixed
$booking_id : mixed
Return values
mixed

showCustom()

public showCustom(array<string|int, mixed> $data, mixed $agency_id, mixed $booking_id, int $id) : object
Parameters
$data : array<string|int, mixed>
$agency_id : mixed
$booking_id : mixed
$id : int
  • Id of the object that we want to show.
Tags
desc

Show the record with the given id

Return values
object

showGeneralConditionsPdf()

public showGeneralConditionsPdf(mixed $agency_id, mixed $booking_id) : mixed
Parameters
$agency_id : mixed
$booking_id : mixed
Return values
mixed

showRentalAgreement()

public showRentalAgreement(mixed $agency_id, mixed $booking_id) : mixed
Parameters
$agency_id : mixed
$booking_id : mixed
Return values
mixed

showRentalAgreementPdf()

public showRentalAgreementPdf(mixed $agency_id, mixed $booking_id) : mixed
Parameters
$agency_id : mixed
$booking_id : mixed
Return values
mixed

showVehicleDocuments()

public showVehicleDocuments(mixed $agency_id, mixed $vehicle_id, mixed $vehicle_plate) : mixed
Parameters
$agency_id : mixed
$vehicle_id : mixed
$vehicle_plate : mixed
Return values
mixed

showWith()

Eager load database relationships

public showWith(mixed $id, string $relations) : Model
Parameters
$id : mixed
$relations : string
  • A name of relations to add
Return values
Model

$model - A specific model

signAdditionalCostsPdf()

public signAdditionalCostsPdf(array<string|int, mixed> $data, mixed $agency_id, mixed $booking_id) : mixed
Parameters
$data : array<string|int, mixed>
$agency_id : mixed
$booking_id : mixed
Return values
mixed

signGeneralConditionsPdf()

public signGeneralConditionsPdf(array<string|int, mixed> $data, mixed $agency_id, mixed $booking_id) : mixed
Parameters
$data : array<string|int, mixed>
$agency_id : mixed
$booking_id : mixed
Return values
mixed

storeCustom()

public storeCustom(array<string|int, mixed> $data, mixed $agency_id, mixed $booking_id) : string
Parameters
$data : array<string|int, mixed>
$agency_id : mixed
$booking_id : mixed
Tags
desc

Create a new record in the database

Return values
string

storeRentalAgreement()

public storeRentalAgreement(array<string|int, mixed> $data, mixed $agency_id, mixed $booking_id) : mixed
Parameters
$data : array<string|int, mixed>
$agency_id : mixed
$booking_id : mixed
Return values
mixed

update()

Updates a record in the database

public update(array<string|int, mixed> $data, int $id) : object
Parameters
$data : array<string|int, mixed>
  • Datas of the object that we want to update.
$id : int
  • Id of the object that we want to update.
Tags
throws
Exception
Return values
object

updateCustom()

public updateCustom(array<string|int, mixed> $data,  $agency_id,  $booking_id, int $id) : string
Parameters
$data : array<string|int, mixed>

Data that should be updated

$agency_id :

User agency id

$booking_id :

Booking id to update

$id : int
  • Id of the vehicle that we want to update.
Tags
desc

Update record from the database

throws
ValidationException
Return values
string

createBookingForBroker()

private createBookingForBroker(array<string|int, mixed> $data, mixed $agency) : mixed
Parameters
$data : array<string|int, mixed>
$agency : mixed
Return values
mixed

createBookingFromBrokerBackoffice()

private createBookingFromBrokerBackoffice(Agency $agency, array<string|int, mixed> $data, Vehicle $vehicle, Booking $bookingBroker) : mixed
Parameters
$agency : Agency

Vendor agency

$data : array<string|int, mixed>
$vehicle : Vehicle
$bookingBroker : Booking

Broker booking

Return values
mixed

createOrUpdateCustomer()

private createOrUpdateCustomer(mixed $data, mixed $agency) : mixed
Parameters
$data : mixed
$agency : mixed
Return values
mixed

loadAdditionalCostsPdf()

private loadAdditionalCostsPdf(mixed $booking) : mixed
Parameters
$booking : mixed
Return values
mixed

loadFinishRentalAgreementPdf()

private loadFinishRentalAgreementPdf(mixed $booking, mixed $breakdowns, mixed $total) : mixed
Parameters
$booking : mixed
$breakdowns : mixed
$total : mixed
Return values
mixed

loadGeneralConditionsPdf()

private loadGeneralConditionsPdf(mixed $booking) : mixed
Parameters
$booking : mixed
Return values
mixed

loadRentalAgreementPdf()

private loadRentalAgreementPdf(mixed $booking) : mixed
Parameters
$booking : mixed
Return values
mixed

storeFinishRentalPdf()

private storeFinishRentalPdf(mixed $booking, mixed $breakdowns, mixed $total) : mixed
Parameters
$booking : mixed
$breakdowns : mixed
$total : mixed
Return values
mixed

storePaymentTransaction()

private storePaymentTransaction(mixed $payment, mixed $value_paid, mixed $paymentIntent, mixed $sessionId) : mixed
Parameters
$payment : mixed
$value_paid : mixed
$paymentIntent : mixed
$sessionId : mixed
Return values
mixed

storeRedsysTransaction()

private storeRedsysTransaction(mixed $payment, mixed $value_paid[, string $type = 'redsys' ]) : mixed
Parameters
$payment : mixed
$value_paid : mixed
$type : string = 'redsys'
Return values
mixed

storeRentalAgreementPdf()

private storeRentalAgreementPdf(mixed $booking) : void
Parameters
$booking : mixed
Return values
void

updateBookingFromBrokerBackoffice()

private updateBookingFromBrokerBackoffice(mixed $vendorAgency, array<string|int, mixed> $data, mixed $vehicle, mixed $bookingVehicle) : mixed
Parameters
$vendorAgency : mixed
$data : array<string|int, mixed>
$vehicle : mixed
$bookingVehicle : mixed
Return values
mixed

updateComment()

private updateComment(mixed $booking_id, string|null $comment) : void
Parameters
$booking_id : mixed
$comment : string|null
Return values
void

Search results