- Adds Character model with survival needs (hunger, thirst, energy) and state machine - Implements city:tick world ticker for offline progression every minute - Adds city territory expansion and building construction system - Introduces job economy, inventory, and transaction audit trail - Adds social graph (friends, marriage, children) and character chat - Implements admin approval workflow for new registrations - Adds hospital admission system for traffic accidents - Includes comprehensive feature tests and world seeders
57 lines
1.2 KiB
PHP
Executable File
57 lines
1.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
/**
|
|
* Employment position offered inside a city (table: job_positions).
|
|
*
|
|
* Characters hold at most one job; salaries accrue while state=working.
|
|
*/
|
|
#[Fillable(['city_id', 'store_id', 'title', 'salary', 'requires_education'])]
|
|
class Job extends Model
|
|
{
|
|
/**
|
|
* Eloquent table name (queue already owns "jobs".
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $table = 'job_positions';
|
|
|
|
/**
|
|
* City offering the position.
|
|
*
|
|
* @return BelongsTo<City, $this>
|
|
*/
|
|
public function city(): BelongsTo
|
|
{
|
|
return $this->belongsTo(City::class);
|
|
}
|
|
|
|
/**
|
|
* Store providing the position, when commercial.
|
|
*
|
|
* @return BelongsTo<Store, $this>
|
|
*/
|
|
public function store(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Store::class);
|
|
}
|
|
|
|
/**
|
|
* Get the attributes that should be cast.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'salary' => 'float',
|
|
'requires_education' => 'integer',
|
|
];
|
|
}
|
|
}
|