This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
Foodloop-Server/lib/Pear/LocalLoop/Controller/Admin/Users.pm

36 lines
669 B
Perl
Raw Normal View History

2017-04-18 09:44:07 +00:00
package Pear::LocalLoop::Controller::Admin::Users;
use Mojo::Base 'Mojolicious::Controller';
has result_set => sub {
my $c = shift;
return $c->schema->resultset('User');
};
sub index {
my $c = shift;
my $user_rs = $c->result_set;
$user_rs->result_class('DBIx::Class::ResultClass::HashRefInflator');
$c->stash( users => [ $user_rs->all ] );
}
sub read {
my $c = shift;
2017-04-18 18:03:03 +00:00
my $id = $c->param('id');
if ( my $user = $c->result_set->find($id) ) {
$c->stash( user => $user );
} else {
$c->flash( error => 'No User found' );
$c->redirect_to( '/admin/users' );
}
2017-04-18 09:44:07 +00:00
}
2017-04-18 18:03:03 +00:00
sub update {
2017-04-18 09:44:07 +00:00
my $c = shift;
2017-04-18 18:03:03 +00:00
$c->redirect_to( '/admin/users' );
2017-04-18 09:44:07 +00:00
}
1;