2026-10-28 20:39:48 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
|
|
|
|
|
|
/** Units of one type standing in a village, owned by their home village. */
|
|
|
|
|
class UnitStack extends Model
|
|
|
|
|
{
|
|
|
|
|
protected $guarded = [];
|
|
|
|
|
|
|
|
|
|
protected function casts(): array
|
|
|
|
|
{
|
|
|
|
|
return ['count' => 'integer'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function village(): BelongsTo
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Village::class);
|
|
|
|
|
}
|
2026-10-28 22:56:55 +00:00
|
|
|
|
|
|
|
|
public function home(): BelongsTo
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Village::class, 'home_village_id');
|
|
|
|
|
}
|
2026-10-28 20:39:48 +00:00
|
|
|
}
|