diff --git a/app/Http/Controllers/Api/V1/Admin/ApiAdminVoucherSetsController.php b/app/Http/Controllers/Api/V1/Admin/ApiAdminVoucherSetsController.php index 2bdbed0..f9e30b1 100644 --- a/app/Http/Controllers/Api/V1/Admin/ApiAdminVoucherSetsController.php +++ b/app/Http/Controllers/Api/V1/Admin/ApiAdminVoucherSetsController.php @@ -35,6 +35,7 @@ class ApiAdminVoucherSetsController extends Controller * Set the related data the GET request is allowed to ask for */ public array $availableRelations = [ + 'createdByUser', 'createdByTeam', 'allocatedToServiceTeam', 'currencyCountry', @@ -121,7 +122,6 @@ class ApiAdminVoucherSetsController extends Controller )] public function index(): JsonResponse { - $this->query = VoucherSet::with($this->associatedData); $this->query = $this->updateReadQueryBasedOnUrl(); $this->data = $this->query->paginate($this->limit); diff --git a/app/Models/VoucherSet.php b/app/Models/VoucherSet.php index 03549a0..a03c831 100644 --- a/app/Models/VoucherSet.php +++ b/app/Models/VoucherSet.php @@ -35,6 +35,12 @@ public function createdByTeam(): BelongsTo return $this->belongsTo(Team::class, 'created_by_team_id', 'id'); } + public function createdByUser(): BelongsTo + { + return $this->belongsTo(User::class, 'created_by_user_id', 'id'); + } + + /** * @return BelongsTo */