ldc-legaulois/app/Models/DeliveryAddress.php

67 lines
1.6 KiB
PHP
Raw Normal View History

2021-03-04 09:38:39 +01:00
<?php
namespace App\Models;
use App\Enums\ContactFormCivility;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
2021-03-04 09:38:39 +01:00
use Kwaadpepper\Enum\Traits\CastsEnums;
/**
*
* @property integer $id
* @property \App\Enums\ContactFormCivility $civility
* @property string $lastname
* @property string $firstname
* @property string $address
* @property string $postcode
* @property string $phone
* @property string $city
* @property integer $order_id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
*
* @property-read \App\Models\Order $order
* @package App\Models
*/
2021-03-04 09:38:39 +01:00
class DeliveryAddress extends Model
{
use CastsEnums;
/**
* The attributes that should be cast to Enums.
*
* @var array
*/
2021-03-04 09:38:39 +01:00
protected $enumCasts = [
'civility' => ContactFormCivility::class
];
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
2021-03-04 09:38:39 +01:00
protected $fillable = [
'civility',
'lastname',
'firstname',
'address',
'postcode',
'city',
'phone'
];
// * RELATIONSHIPS
/**
* Get the order that owns the DeliveryAddress
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function order(): BelongsTo
2021-03-04 09:38:39 +01:00
{
return $this->belongsTo(Order::class);
}
}