Documentation

Service extends Model Uses HasFactory, HasSlug, SoftDeletes

Table of Contents

$appends  : array<string|int, mixed>
The accessors to append to the model's array form.
$casts  : array<string|int, mixed>
The attributes that should be cast.
$dates  : array<string|int, mixed>
Column for soft deletes
$fillable  : array<string|int, mixed>
The attributes that are mass assignable.
$hidden  : array<string|int, mixed>
The attributes excluded from the model's JSON form.
$table  : string
The table associated with the model.
$with  : array<string|int, mixed>
The attributes that should be cast.
bookings()  : hasMany
Get the bookings that belong to this service.
category()  : belongsTo
Get the service category that have this service.
deletePictures()  : true
employees()  : belongsToMany
Get all the employees that have this service.
getAbsenceServicesIds()  : array<string|int, mixed>
Get the IDs of the services that are declared as employee absences
getNumberOfEmployeesAttribute()  : int
Get number of employees associated to a service
getRouteKeyName()  : string
Get the route key for the model.
getSlugOptions()  : SlugOptions
Get the options for generating the slug.
getStoreNameAttribute()  : string
Get the store name this service belongs to
pictures()  : hasMany
Get the pictures that belong to this service.
savePicture()  : true
store()  : belongsTo
Get the store that have this service.
getAttachmentPath()  : string

Properties

$appends

The accessors to append to the model's array form.

protected array<string|int, mixed> $appends = ['number_of_employees']

$casts

The attributes that should be cast.

protected array<string|int, mixed> $casts = ['name' => 'string', 'description' => 'string', 'price' => 'float', 'on_promotion' => 'boolean', 'discount' => 'integer', 'time' => 'integer', 'slug' => 'string', 'reminder_days' => 'integer']

$dates

Column for soft deletes

protected array<string|int, mixed> $dates = ["deleted_at"]

$fillable

The attributes that are mass assignable.

protected array<string|int, mixed> $fillable = ['name', 'description', 'price', 'on_promotion', 'discount', 'time', 'service_category_id', 'slug', 'order', 'reminder_days']

$hidden

The attributes excluded from the model's JSON form.

protected array<string|int, mixed> $hidden = ['service_category_id', 'store_id', 'updated_at', 'created_at', 'deleted_at', 'pivot']

$table

The table associated with the model.

protected string $table = "services"

$with

The attributes that should be cast.

protected array<string|int, mixed> $with = ['pictures', 'category']

Methods

bookings()

Get the bookings that belong to this service.

public bookings() : hasMany
Return values
hasMany

category()

Get the service category that have this service.

public category() : belongsTo
Return values
belongsTo

deletePictures()

public deletePictures() : true
Tags
desc

delete all images an delete previous

throws
Exception
Return values
true

employees()

Get all the employees that have this service.

public employees() : belongsToMany
Return values
belongsToMany

getAbsenceServicesIds()

Get the IDs of the services that are declared as employee absences

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

IDs of the services

getNumberOfEmployeesAttribute()

Get number of employees associated to a service

public getNumberOfEmployeesAttribute() : int
Return values
int

getRouteKeyName()

Get the route key for the model.

public getRouteKeyName() : string
Return values
string

getSlugOptions()

Get the options for generating the slug.

public getSlugOptions() : SlugOptions
Return values
SlugOptions

getStoreNameAttribute()

Get the store name this service belongs to

public getStoreNameAttribute() : string
Return values
string

pictures()

Get the pictures that belong to this service.

public pictures() : hasMany
Return values
hasMany

savePicture()

public savePicture( $file,  $type) : true
Parameters
$file :
  • The file to upload
$type :
  • The img´s type
Tags
desc

Save an image an delete previous

throws
Exception
Return values
true

store()

Get the store that have this service.

public store() : belongsTo
Return values
belongsTo

getAttachmentPath()

private getAttachmentPath() : string
Tags
desc

Generate path to save attachment

Return values
string

Search results