- Player-to-player marketplace with listings, buying and selling - Mission system with progress tracking and money rewards - Character appearance customization (skin, hair, face, beard, accessory) - Multiplayer presence feed showing nearby citizens in near-real-time - Admin world dashboard with live platform metrics - Bus and train transportation with temporary ride state - Mobile joystick controls and minimap HUD - Education bonus applied to work salary
41 lines
1.0 KiB
PHP
41 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
|
/**
|
|
* Catalog mission that citizens can complete for a reward.
|
|
*/
|
|
#[Fillable(['city_id', 'code', 'title', 'description', 'metric', 'target', 'reward', 'is_active'])]
|
|
class Mission extends Model
|
|
{
|
|
/**
|
|
* Characters tracking this mission.
|
|
*
|
|
* @return BelongsToMany<Character, $this>
|
|
*/
|
|
public function characters(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Character::class, 'character_missions')
|
|
->withPivot(['progress', 'is_completed', 'completed_at'])
|
|
->withTimestamps();
|
|
}
|
|
|
|
/**
|
|
* Get the attributes that should be cast.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'reward' => 'float',
|
|
'target' => 'integer',
|
|
'is_active' => 'boolean',
|
|
];
|
|
}
|
|
}
|