Documentation

StoreRepository extends Repository

Table of Contents

RESPONSE_STATUS_ERROR  = 'error'
RESPONSE_STATUS_FAIL  = 'fail'
RESPONSE_STATUS_SUCCESS  = 'success'
$childRelationName  : mixed
$model  : mixed
$parentRepo  : mixed
$repo  : mixed
__construct()  : object
all()  : array<string|int, mixed>
Create list from stores filtered by name
allChild()  : string
cleanNullValues()  : null
Change null values and put string("")
delete()  : string
Delete store and his pictures from the database
deleteChild()  : bool
ensureHttp400Code()  : string
Return a extension from mimetype
firstOrCreate()  : object
firstOrNew()  : object
forceDelete()  : bool
getCustomLabelFormat()  : array<string|int, mixed>
Return an array with custom label format
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
getObject()  : array<string|int, mixed>
getSuccessResponse()  : array<string|int, mixed>
Return all an array of errors like validation in one format
getUserStore()  : mixed
invoicePayment()  : mixed
mime2ext()  : string
Return a extension from mimetype
orderQuery()  : null
Destroy record from the database
paginate()  : array<string|int, mixed>
Create a paginated list from stores
paginateChild()  : array<string|int, mixed>
setModel()  : mixed
setState()  : mixed
show()  : object
Show the record with the given id
showChild()  : object
showStoreBySlug()  : object
Show the record with the given slug
showStoreInvoiceData()  : object
Show the record with the given id
store()  : object
storeChild()  : object
storeInvoiceData()  : mixed
create one store´s invoice data
storeList()  : array<string|int, mixed>
Create a paginated list from stores
update()  : string
Update record from the database
updateChild()  : object
getAdminStore()  : mixed
getPublicStore()  : mixed
savePicture()  : string
Save the pictures depend his type
validationRules()  : array<string|int, mixed>
Validation rules

Constants

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

$childRelationName

protected mixed $childRelationName

Methods

__construct()

public __construct(Store $model) : object
Parameters
$model : Store
  • A specific model
Return values
object

all()

Create list from stores filtered by name

public all(Request $request) : array<string|int, mixed>

The call gives a list if stores.

Parameters
$request : Request
Return values
array<string|int, mixed>

allChild()

public allChild(Request $request, int $parent_id) : string
Parameters
$request : Request
$parent_id : int
  • Id of the parent objects that we want to get.
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

delete()

Delete store and his pictures from the database

public delete(Request $request, int $id) : string

Only store´s manager can delete his store

Parameters
$request : Request
  • Datas of the object that we want to update.
$id : int

Id of the store that we want to update.

Return values
string

deleteChild()

public deleteChild(Request $request, mixed $parent_id, int $id) : bool
Parameters
$request : Request
$parent_id : mixed
$id : int
  • Id of the object that we want to remove.
Tags
desc

Remove record from the database (Soft)

Return values
bool
  • Success or fail

ensureHttp400Code()

Return a extension from mimetype

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

firstOrCreate()

public firstOrCreate(Request $request) : object
Parameters
$request : Request
Tags
desc

Create a new record in the database

Return values
object

firstOrNew()

public firstOrNew(Request $request) : object
Parameters
$request : Request
Tags
desc

Create a new record in the database

Return values
object

forceDelete()

public forceDelete(Request $request, int $id) : bool
Parameters
$request : Request
$id : int
  • Id of the object that we want to remove.
Tags
desc

Remove record from the database

Return values
bool
  • Success or fail

getCustomLabelFormat()

Return an array with custom label format

public getCustomLabelFormat(string $customLabel[, array<string|int, mixed> $data = NULL ]) : array<string|int, mixed>
Parameters
$customLabel : string
  • New response label
$data : array<string|int, mixed> = NULL
  • Response datas
Return values
array<string|int, mixed>

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

public getModel() : Model
Tags
desc

Get the associated model

Return values
Model

$model - A specific model

getObject()

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

Get instances of model

Return values
array<string|int, mixed>

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>

getUserStore()

public getUserStore() : mixed
Tags
desc

Get user store for employees and managers roles

Return values
mixed

invoicePayment()

public invoicePayment(Request $request, mixed $invoice_id) : mixed
Parameters
$request : Request
$invoice_id : mixed
Return values
mixed

mime2ext()

Return a extension from mimetype

public mime2ext(string $mime) : string
Parameters
$mime : string
  • String with mimetype
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()

Create a paginated list from stores

public paginate(Request $request) : array<string|int, mixed>

The call give a list paginated. We give all pictures from stores We dont show the stores'id

Parameters
$request : Request
Return values
array<string|int, mixed>

paginateChild()

public paginateChild(Request $request, mixed $parent_id) : array<string|int, mixed>
Parameters
$request : Request
$parent_id : mixed
Tags
desc

Get all instances of model paginate

Return values
array<string|int, mixed>

setModel()

public setModel(Model $model) : mixed
Parameters
$model : Model
  • A specific model
Tags
desc

Set the associated model

Return values
mixed

setState()

public setState(Request $request, mixed $id) : mixed
Parameters
$request : Request
$id : mixed
Return values
mixed

show()

Show the record with the given id

public show(Request $request, int $id) : object

The call give the data from one store The managers only can see their stores We have a list of the pictures from stores

Parameters
$request : Request
$id : int
  • Id of the object that we want to show.
Return values
object

showChild()

public showChild(Request $request, mixed $parent_id, int $id) : object
Parameters
$request : Request
$parent_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

showStoreBySlug()

Show the record with the given slug

public showStoreBySlug(Request $request, mixed $store_slug[, mixed $field = 'slug' ]) : object

The call give the data from one store The external users cant get the store id

Parameters
$request : Request
$store_slug : mixed
$field : mixed = 'slug'
Return values
object

showStoreInvoiceData()

Show the record with the given id

public showStoreInvoiceData() : object

The call give the data from one store The managers only can see their stores We have a list of the pictures from stores

Return values
object

store()

public store(Request $request) : object
Parameters
$request : Request
Tags
desc

Create a new record in the database

Return values
object

storeChild()

public storeChild(Request $request, mixed $parent_id) : object
Parameters
$request : Request
$parent_id : mixed
Tags
desc

Create a new record in the database

Return values
object

storeInvoiceData()

create one store´s invoice data

public storeInvoiceData(Request $request) : mixed
Parameters
$request : Request
Tags
throws
ValidationException
Return values
mixed

storeList()

Create a paginated list from stores

public storeList(Request $request) : array<string|int, mixed>

The call give a list paginated. We give all pictures from stores We dont show the stores'id

Parameters
$request : Request
Return values
array<string|int, mixed>

update()

Update record from the database

public update(Request $request, int $id) : string

Only store´s manager can update data from his store

Parameters
$request : Request
  • Datas of the object that we want to update.
$id : int

Id of the store that we want to update.

Return values
string

updateChild()

public updateChild(Request $request, mixed $parent_id, int $id) : object
Parameters
$request : Request
$parent_id : mixed
$id : int
  • Id of the object that we want to update.
Tags
desc

Update record in the database

Return values
object

getAdminStore()

private getAdminStore(mixed $query) : mixed
Parameters
$query : mixed
Return values
mixed

getPublicStore()

private getPublicStore(mixed $serviceSlug, mixed $storeCategoryId, mixed $location) : mixed
Parameters
$serviceSlug : mixed
$storeCategoryId : mixed
$location : mixed
Return values
mixed

savePicture()

Save the pictures depend his type

private savePicture(Request $request,  $store) : string

We save the picture and give a type (logo, main, gallery) If the picture is logo or main, the picture will be overwritten

Parameters
$request : Request
  • Datas of the object that we want to update.
$store :

Store data

Return values
string

validationRules()

Validation rules

private validationRules(mixed $id_store) : array<string|int, mixed>
Parameters
$id_store : mixed
Return values
array<string|int, mixed>

Search results