I have to use Catalyst in order to create a database and access it through a browser. I have created a very simple database using DBIx-class and sqlite, just one table and filled it with some records. I have managed to display the whole table and its rows using Template Toolkit view module and the code below into my controller.
$c->stash(ptm => [$c->model('DB::ptm')->all]);
Now I have created a simple search box in order to search the database and display any entries that match with the keyword, but I don't know how to pass the keyword to my controller nor how to implement the subroutine in order to achieve this.
I have searched for more than three days without finding any solution.
There are two completely different problems here.
So, starting with the first one. Reading a query string.
$c->request->query_parameters->{field}
Then performing a search. Just call search
instead of all
and pass a hashref of your columns and values.
$c->model('DB::ptm')->search( { 'name' => $tag } );