75 lines
1.5 KiB
PHP
75 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* @property integer $id
|
|
* @property integer $type_id
|
|
* @property integer $region_id
|
|
* @property string $state
|
|
* @property string $street
|
|
* @property string $zipcode
|
|
* @property string $city
|
|
* @property float $latitude
|
|
* @property float $longitude
|
|
* @property string $created_at
|
|
* @property string $updated_at
|
|
* @property StoreType $storeType
|
|
* @property StoreRegion $storeRegion
|
|
*/
|
|
class Store extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'type_id',
|
|
'region_id',
|
|
'state',
|
|
'street',
|
|
'zipcode',
|
|
'city',
|
|
'latitude',
|
|
'longitude',
|
|
'created_at',
|
|
'updated_at'
|
|
];
|
|
|
|
// * EVENTS
|
|
|
|
/**
|
|
* Perform any actions required after the model boots.
|
|
*
|
|
* @return void
|
|
*/
|
|
protected static function booted()
|
|
{
|
|
static::creating(function (self $model) {
|
|
});
|
|
static::updating(function (self $model) {
|
|
});
|
|
}
|
|
|
|
// * RELATIONSHIPS
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
*/
|
|
public function storeType()
|
|
{
|
|
return $this->belongsTo('App\Models\StoreType', 'type_id');
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
*/
|
|
public function storeRegion()
|
|
{
|
|
return $this->belongsTo('App\Models\StoreRegion', 'region_id');
|
|
}
|
|
}
|