43 lines
905 B
PHP
43 lines
905 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class BuildOrder extends Model
|
|
{
|
|
public const BUILD = 'build';
|
|
|
|
public const UPGRADE = 'upgrade';
|
|
|
|
public const DEMOLISH = 'demolish';
|
|
|
|
protected $guarded = [];
|
|
|
|
protected $dateFormat = 'Y-m-d H:i:s.v';
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'cost' => 'array',
|
|
'target_level' => 'integer',
|
|
'x' => 'integer',
|
|
'y' => 'integer',
|
|
'builder' => 'integer',
|
|
'starts_at' => 'immutable_datetime',
|
|
'finishes_at' => 'immutable_datetime',
|
|
];
|
|
}
|
|
|
|
public function village(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Village::class);
|
|
}
|
|
|
|
public function building(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Building::class);
|
|
}
|
|
}
|