feat: add user sessoins

This commit is contained in:
2025-09-04 10:27:35 +03:30
parent 1b33b89ec2
commit cb8a6714c2
3 changed files with 14 additions and 4 deletions
@@ -118,5 +118,14 @@ public function completeSession(Request $request)
return response()->json(['message' => 'Session completed', 'session' => $session]);
}
public function getSessions()
{
$user = auth()->user();
$templates = BreathingTemplate::where('user_id', $user->id)->get();
$sessions = UserBreathingSession::with('template')->where('user_id', $user->id)->get();
return response()->json($sessions);
}
}
+4 -4
View File
@@ -8,10 +8,10 @@
class DatabaseSeeder extends Seeder
{
public function run(): void
{
$this->call(BreathingTemplateSeeder::class);
}
// public function run(): void
// {
// $this->call(BreathingTemplateSeeder::class);
// }
/**
* Seed the application's database.
*/
+1
View File
@@ -76,6 +76,7 @@
Route::put('breathing-templates/{id}', [BreathingExerciseController::class, 'updateTemplate']);
Route::delete('breathing-templates/{id}', [BreathingExerciseController::class, 'deleteTemplate']);
Route::get('user-templates', [BreathingExerciseController::class, 'getUserTemplates']);
Route::get('breathing-sessions', [BreathingExerciseController::class, 'getSessions']);
/// worry box feature
Route::prefix('worries')->controller(WorryController::class)->group(function () {