added chart for displaying health metrix
This commit is contained in:
1 parent
a325919cd0
commit
87051e179d
22 files changed
+1383
-63
No files matched your search
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\Goal;
|
||||
use App\Models\User;
|
||||
|
||||
class GoalSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// Get the first user or create sample goals for existing users
|
||||
$users = User::all();
|
||||
|
||||
if ($users->isEmpty()) {
|
||||
return; // No users to seed goals for
|
||||
}
|
||||
|
||||
foreach ($users as $user) {
|
||||
// Create sample goals
|
||||
Goal::create([
|
||||
'user_id' => $user->id,
|
||||
'title' => 'Weight Loss Goal',
|
||||
'description' => 'Reach target weight of 170 lbs.',
|
||||
'start_date' => now()->subDays(30),
|
||||
'target_date' => now()->addDays(60),
|
||||
'current_progress_value' => 175.0,
|
||||
'target_value' => 170.0,
|
||||
'status' => 'active',
|
||||
'priority_level' => 'high',
|
||||
'unit' => 'lbs',
|
||||
'icon_type' => 'target',
|
||||
]);
|
||||
|
||||
Goal::create([
|
||||
'user_id' => $user->id,
|
||||
'title' => 'Bench Press Strength',
|
||||
'description' => 'Increase bench press to 200 lbs.',
|
||||
'start_date' => now()->subDays(15),
|
||||
'target_date' => now()->addDays(45),
|
||||
'current_progress_value' => 180.0,
|
||||
'target_value' => 200.0,
|
||||
'status' => 'active',
|
||||
'priority_level' => 'medium',
|
||||
'unit' => 'lbs',
|
||||
'icon_type' => 'dumbbell',
|
||||
]);
|
||||
|
||||
Goal::create([
|
||||
'user_id' => $user->id,
|
||||
'title' => '5K Running Time',
|
||||
'description' => 'Complete 5K run in under 25 minutes.',
|
||||
'start_date' => now()->subDays(20),
|
||||
'target_date' => now()->addDays(40),
|
||||
'current_progress_value' => 27.5,
|
||||
'target_value' => 25.0,
|
||||
'status' => 'active',
|
||||
'priority_level' => 'medium',
|
||||
'unit' => 'min',
|
||||
'icon_type' => 'clock',
|
||||
]);
|
||||
|
||||
Goal::create([
|
||||
'user_id' => $user->id,
|
||||
'title' => 'Daily Steps Goal',
|
||||
'description' => 'Walk 10,000 steps per day.',
|
||||
'start_date' => now()->subDays(10),
|
||||
'target_date' => now()->addDays(20),
|
||||
'current_progress_value' => 8500.0,
|
||||
'target_value' => 10000.0,
|
||||
'status' => 'completed',
|
||||
'priority_level' => 'low',
|
||||
'unit' => 'steps',
|
||||
'icon_type' => 'target',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\User;
|
||||
use App\Models\TournamentEvent;
|
||||
use App\Models\PerformanceResult;
|
||||
use App\Models\NotesMedia;
|
||||
|
||||
class TournamentSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// Get the first user or create one
|
||||
$user = User::first() ?? User::factory()->create();
|
||||
|
||||
// Create tournament events
|
||||
$events = [
|
||||
[
|
||||
'title' => 'National Swimming Championship 2023',
|
||||
'type' => 'championship',
|
||||
'sport' => 'Swimming',
|
||||
'date' => '2023-08-15',
|
||||
'time' => '10:00',
|
||||
'location' => 'Olympic Pool, Bahrain',
|
||||
'participants_count' => 50,
|
||||
],
|
||||
[
|
||||
'title' => 'Regional Basketball Tournament',
|
||||
'type' => 'tournament',
|
||||
'sport' => 'Basketball',
|
||||
'date' => '2023-06-20',
|
||||
'time' => '14:00',
|
||||
'location' => 'Sports Arena, Manama',
|
||||
'participants_count' => 32,
|
||||
],
|
||||
[
|
||||
'title' => 'Youth Football League Finals',
|
||||
'type' => 'championship',
|
||||
'sport' => 'Football',
|
||||
'date' => '2023-05-10',
|
||||
'time' => '16:00',
|
||||
'location' => 'National Stadium',
|
||||
'participants_count' => 16,
|
||||
],
|
||||
[
|
||||
'title' => 'Tennis Open Championship',
|
||||
'type' => 'championship',
|
||||
'sport' => 'Tennis',
|
||||
'date' => '2023-04-05',
|
||||
'time' => '09:00',
|
||||
'location' => 'Tennis Club, Bahrain',
|
||||
'participants_count' => 24,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($events as $eventData) {
|
||||
$event = TournamentEvent::create(array_merge($eventData, ['user_id' => $user->id]));
|
||||
|
||||
// Add performance results
|
||||
if ($event->sport === 'Swimming') {
|
||||
PerformanceResult::create([
|
||||
'tournament_event_id' => $event->id,
|
||||
'description' => '100m Freestyle - Personal Best',
|
||||
'medal_type' => '1st',
|
||||
'points' => 100,
|
||||
]);
|
||||
} elseif ($event->sport === 'Basketball') {
|
||||
PerformanceResult::create([
|
||||
'tournament_event_id' => $event->id,
|
||||
'description' => 'MVP Award',
|
||||
'medal_type' => 'special',
|
||||
'points' => 50,
|
||||
]);
|
||||
} elseif ($event->sport === 'Football') {
|
||||
PerformanceResult::create([
|
||||
'tournament_event_id' => $event->id,
|
||||
'description' => 'Golden Boot Winner',
|
||||
'medal_type' => 'special',
|
||||
'points' => 75,
|
||||
]);
|
||||
PerformanceResult::create([
|
||||
'tournament_event_id' => $event->id,
|
||||
'description' => 'Championship Title',
|
||||
'medal_type' => '1st',
|
||||
'points' => 200,
|
||||
]);
|
||||
} elseif ($event->sport === 'Tennis') {
|
||||
PerformanceResult::create([
|
||||
'tournament_event_id' => $event->id,
|
||||
'description' => 'Singles Final',
|
||||
'medal_type' => '2nd',
|
||||
'points' => 80,
|
||||
]);
|
||||
}
|
||||
|
||||
// Add notes/media
|
||||
NotesMedia::create([
|
||||
'tournament_event_id' => $event->id,
|
||||
'note_text' => 'Outstanding performance in the championship. Set new personal records.',
|
||||
'media_link' => 'https://example.com/ceremony-photo.jpg',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user