- Add database migrations for market_listings, missions and character cosmetics - Create controllers for marketplace, missions, presence and character customization - Implement admin world dashboard with live platform metrics - Add feature tests for world functionality - Include phase 2 design documents and gap analysis
41 lines
1.0 KiB
PHP
Executable File
41 lines
1.0 KiB
PHP
Executable File
<?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',
|
|
];
|
|
}
|
|
}
|