View Transactions from a User on their page

This commit is contained in:
Finn 2017-09-05 12:27:37 +01:00
parent cae2806ad2
commit cd6c075588
2 changed files with 36 additions and 1 deletions

View file

@ -33,7 +33,17 @@ sub read {
my $id = $c->param('id');
if ( my $user = $c->user_result_set->find($id) ) {
$c->stash( user => $user );
my $transactions = $user->entity->purchases->search(
undef, {
page => $c->param('page') || 1,
rows => 10,
order_by => { -desc => 'submitted_at' },
},
);
$c->stash(
user => $user,
transactions => $transactions,
);
} else {
$c->flash( error => 'No User found' );
$c->redirect_to( '/admin/users' );