From cfaddeec451e87d8d7c60feea42b41abcc0bab6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anna-Sara=20S=C3=A9lea?= Date: Tue, 30 Dec 2025 09:34:48 +0100 Subject: [PATCH] Updated data you get from api --- app/Http/Controllers/ParticipantController.php | 18 ++++++++++++------ docs/endpoints.md | 9 +++++++-- docs/keys.md | 12 ++++++------ 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/app/Http/Controllers/ParticipantController.php b/app/Http/Controllers/ParticipantController.php index f9160d8..6d462f8 100644 --- a/app/Http/Controllers/ParticipantController.php +++ b/app/Http/Controllers/ParticipantController.php @@ -18,8 +18,12 @@ class ParticipantController extends Controller if ($permission === "key_1") { - $participants = Participant::all()->makeHidden(['comment', 'emailed', 'paid', 'member', 'gdpr']); - $volunteers = Volunteer::all()->makeHidden(['gdpr', 'emailed']); + $participants = Participant::whereNotNull('lan_id') + ->select('id','lan_id', 'first_name', 'surname','grade','phone','email', 'guardian_name', 'guardian_phone', 'guardian_email', 'is_visiting','friends', 'special_diet', 'status','created_at', 'updated_at') + ->get(); + $volunteers = Volunteer::whereNotNull('lan_id') + ->select('id','lan_id', 'first_name', 'surname','phone','email', 'areas', 'created_at', 'updated_at') + ->get(); $dataArr = [ 'code' => 200, @@ -32,8 +36,8 @@ class ParticipantController extends Controller if ($permission === "key_2") { - $participants = Participant::all()->select('participant_id', 'first_name', 'surname'); - $volunteers = Volunteer::all()->select('first_name', 'surname'); + $participants = Participant::whereNotNull('lan_id')->select('lan_id', 'first_name', 'surname', 'guardian_name')->get(); + $volunteers = Volunteer::whereNotNull('lan_id')->select('lan_id','first_name', 'surname')->get(); $dataArr = [ 'code' => 200, @@ -46,7 +50,9 @@ class ParticipantController extends Controller if ($permission === "key_3") { - $participants = Participant::all()->makeHidden(['comment', 'emailed', 'paid', 'member', 'gdpr']); + $participants = Participant::whereNotNull('lan_id') + ->select('id','lan_id', 'first_name', 'surname','grade','phone','email', 'guardian_name', 'guardian_phone', 'guardian_email', 'is_visiting','friends', 'special_diet', 'status','created_at', 'updated_at') + ->get(); return $dataArr = [ 'code' => 200, @@ -56,7 +62,7 @@ class ParticipantController extends Controller if ($permission === "key_4") { - $participants = Participant::all()->select('participant_id', 'first_name', 'surname'); + $participants = Participant::whereNotNull('lan_id')->select('lan_id', 'first_name', 'surname', 'guardian_name')->get(); return $dataArr = [ 'code' => 200, diff --git a/docs/endpoints.md b/docs/endpoints.md index af9690f..154a042 100644 --- a/docs/endpoints.md +++ b/docs/endpoints.md @@ -70,12 +70,15 @@ { "participants": [ { + "lan_id": 1, "first_name": "John", - "surname": "Doe" + "surname": "Doe", + "guardian_name": "John Doe" } ], "volunteers": [ { + "lan_id": 1, "first_name": "Jane", "surname": "Doe" } @@ -114,8 +117,10 @@ { "participants": [ { + "lan_id": 1, "first_name": "John", - "surname": "Doe" + "surname": "Doe", + "guardian_name": "John Doe" } ] } diff --git a/docs/keys.md b/docs/keys.md index 63a8c3d..ecbd2a7 100644 --- a/docs/keys.md +++ b/docs/keys.md @@ -1,10 +1,10 @@ ## API Keys -> | key | permissions | -> |--------------|-----------------------------------------------------------------------| -> | `KEY 1` | All data from Participants and Volunteers. Can post | -> | `KEY 2` | {lan_id, first_name, surname} from table Participants and Volunteers | -> | `KEY 3` | All data from table Participants | -> | `KEY 4` | {lan_id, first_name, surname} from table Participants | +> | key | permissions | +> |--------------|--------------------------------------------------------------------------------------| +> | `KEY 1` | All data from Participants and Volunteers. Can post | +> | `KEY 2` | {lan_id, first_name, surname, guardian_name} from table Participants and Volunteers | +> | `KEY 3` | All data from table Participants | +> | `KEY 4` | {lan_id, first_name, surname, guardian_name} from table Participants |