- 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
35 lines
785 B
PHP
Executable File
35 lines
785 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
/**
|
|
* Chat message exchanged between two characters.
|
|
*/
|
|
#[Fillable(['from_character_id', 'to_character_id', 'body'])]
|
|
class CharacterMessage extends Model
|
|
{
|
|
/**
|
|
* Sending character.
|
|
*
|
|
* @return BelongsTo<Character, $this>
|
|
*/
|
|
public function fromCharacter(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Character::class, 'from_character_id');
|
|
}
|
|
|
|
/**
|
|
* Receiving character.
|
|
*
|
|
* @return BelongsTo<Character, $this>
|
|
*/
|
|
public function toCharacter(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Character::class, 'to_character_id');
|
|
}
|
|
}
|