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/Feedback.pm

29 lines
566 B
Perl

package Pear::LocalLoop::Controller::Admin::Feedback;
use Mojo::Base 'Mojolicious::Controller';
has result_set => sub {
my $c = shift;
return $c->schema->resultset('Feedback');
};
sub index {
my $c = shift;
my $feedback_rs = $c->result_set;
$c->stash( feedbacks => [ $feedback_rs->all ] );
}
sub read {
my $c = shift;
my $id = $c->param('id');
if ( my $feedback = $c->result_set->find($id) ) {
$c->stash( feedback => $feedback );
} else {
$c->flash( error => 'No Feedback found' );
$c->redirect_to( '/admin/feedback' );
}
}
1;