93 lines
1.8 KiB
PHP
93 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Kwaadpepper\Enum\Traits\CastsEnums;
|
|
use LDC\LDCCRM\Enums\Country;
|
|
use Propaganistas\LaravelPhone\Casts\E164PhoneNumberCast;
|
|
|
|
class Shop extends Model
|
|
{
|
|
use CastsEnums;
|
|
use HasFactory;
|
|
|
|
/**
|
|
* The attributes that should be cast to native types.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $casts = [
|
|
'phone' => E164PhoneNumberCast::class . ':FR'
|
|
];
|
|
|
|
/**
|
|
* Map attribute names to enum classes.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $enumCasts = [
|
|
'country' => Country::class
|
|
];
|
|
|
|
/**
|
|
* The model's attributes.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $attributes = [
|
|
'phone_country' => 'FR'
|
|
];
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'name',
|
|
'address',
|
|
'postal_code',
|
|
'city',
|
|
'country',
|
|
'phone',
|
|
'latitude',
|
|
'longitude',
|
|
'gmaps_placeid',
|
|
'gmaps_link_href',
|
|
'gmaps_embed_href',
|
|
];
|
|
|
|
// * RELATIONSHIPS
|
|
|
|
/**
|
|
* hasMany timeslot settings relation
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function timeslotSettings()
|
|
{
|
|
return $this->hasMany(TimeslotSetting::class);
|
|
}
|
|
|
|
/**
|
|
* hasMany collection exceptions relation
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function collectionExceptions()
|
|
{
|
|
return $this->hasMany(CollectionException::class);
|
|
}
|
|
|
|
/**
|
|
* hasMany timeslots relation
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function timeslots()
|
|
{
|
|
return $this->hasMany(Timeslot::class);
|
|
}
|
|
}
|