Skip to content

Commit

Permalink
Added createdByUser relation on voucher set
Browse files Browse the repository at this point in the history
  • Loading branch information
ok200paul committed Dec 2, 2024
1 parent ae1f5e9 commit 20f06e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions app/Models/VoucherSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 20f06e4

Please sign in to comment.