From 0d5601505b367ee4c5386251c84bc195c9de6422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anna-Sara=20S=C3=A9lea?= Date: Sat, 15 Nov 2025 17:09:14 +0100 Subject: [PATCH] Version model --- app/Http/Controllers/VersionController.php | 114 ++++++++++++++++++ app/Models/Version.php | 13 ++ ...025_11_11_194141_create_versions_table.php | 29 +++++ public/css/app/filament-gaze-stylesheet.css | 35 ++++++ 4 files changed, 191 insertions(+) create mode 100644 app/Http/Controllers/VersionController.php create mode 100644 app/Models/Version.php create mode 100644 database/migrations/2025_11_11_194141_create_versions_table.php create mode 100644 public/css/app/filament-gaze-stylesheet.css diff --git a/app/Http/Controllers/VersionController.php b/app/Http/Controllers/VersionController.php new file mode 100644 index 0000000..e61517b --- /dev/null +++ b/app/Http/Controllers/VersionController.php @@ -0,0 +1,114 @@ +ability; + + if ($ability === "key_1") { + + $latest_version_participants = Version::where('table', 'participants')->latest()->first(); + $latest_version_volunteers = Version::where('table', 'volunteers')->latest()->first(); + + return response()->json([ + 'success' => true, 'participants' => $latest_version_participants ? $latest_version_participants->version : null , 'volunteers' => $latest_version_volunteers ? $latest_version_volunteers->version : null + ]); + + } + + if ($ability === "key_2") { + + $latest_version_participants = Version::where('table', 'participants')->latest()->first(); + $latest_version_volunteers = Version::where('table', 'volunteers')->latest()->first(); + + return response()->json([ + 'success' => true, 'participants' => $latest_version_participants ? $latest_version_participants->version : null , 'volunteers' => $latest_version_volunteers ? $latest_version_volunteers->version : null + ]); + + } + + if ($ability === "key_3") { + + $latest_version_participants = Version::where('table', 'participants')->latest()->first(); + + + return response()->json([ + 'success' => true, 'participants' => $latest_version_participants ? $latest_version_participants->version : null + ]); + + } + + if ($ability === "key_4") { + + + $latest_version_participants = Version::where('table', 'participants')->latest()->first(); + + + return response()->json([ + 'success' => true, 'participants' => $latest_version_participants ? $latest_version_participants->version : null + ]); + + } + + return response()->json([ + 'success' => false, 'message' => 'Unauthorized' + ]); + } + + /** + * Show the form for creating a new resource. + */ + public function create() + { + // + } + + /** + * Store a newly created resource in storage. + */ + public function store(Request $request) + { + // + } + + /** + * Display the specified resource. + */ + public function show(Version $version) + { + // + } + + /** + * Show the form for editing the specified resource. + */ + public function edit(Version $version) + { + // + } + + /** + * Update the specified resource in storage. + */ + public function update(Request $request, Version $version) + { + // + } + + /** + * Remove the specified resource from storage. + */ + public function destroy(Version $version) + { + // + } +} diff --git a/app/Models/Version.php b/app/Models/Version.php new file mode 100644 index 0000000..ac73976 --- /dev/null +++ b/app/Models/Version.php @@ -0,0 +1,13 @@ +id(); + $table->string('table')->nullable(); + $table->integer('version')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('versions'); + } +}; diff --git a/public/css/app/filament-gaze-stylesheet.css b/public/css/app/filament-gaze-stylesheet.css new file mode 100644 index 0000000..e8654ac --- /dev/null +++ b/public/css/app/filament-gaze-stylesheet.css @@ -0,0 +1,35 @@ +/* We use this to prevent the gap/space creating ghost elements */ +div:has(> .gaze-banner:not(.gaze-banner--has-content)) { + display: none; +} + +.fi-gaze-banner { + display: flex; + flex-direction: row; + align-items: center; + gap: 1rem; + border-radius: 0.75rem; + padding: 1.5rem; + border: 1px solid var(--primary-500); + color: var(--primary-500); + background-color: var(--gray-100); +} + + +.fi.dark .fi-gaze-banner { + background-color: var(--color-gray-900); +} + +.fi-gaze-banner .icon-container { + flex-shrink: 0; +} + +.fi-gaze-banner .text-container { + display: flex; + flex-direction: column; + flex: 1; +} + +.fi-gaze-banner .button-container { + flex-shrink: 0; +}