| 1 | package Mojolicious::Plugin::RoutesAuthDBI::Model::Routes; | ||
| 2 | #~ use Mojo::Base 'DBIx::Mojo::Model'; | ||
| 3 | use Mojo::Base 'Mojolicious::Plugin::RoutesAuthDBI::Model::Base'; | ||
| 4 | |||
| 5 | #~ sub new { | ||
| 6 | #~ state $self = shift->SUPER::new(@_); | ||
| 7 | #~ } | ||
| 8 | |||
| 9 | sub routes { | ||
| 10 | my $self = ref($_[0]) ? shift : shift->new; | ||
| 11 | |||
| 12 | $self->dbh->selectall_arrayref($self->sth('apply routes'), { Slice => {} },); | ||
| 13 | } | ||
| 14 | |||
| 15 | sub routes_ref { | ||
| 16 | my $self = ref($_[0]) ? shift : shift->new; | ||
| 17 | $self->dbh->selectall_arrayref($self->sth('role routes'), { Slice => {} }, (shift)); | ||
| 18 | } | ||
| 19 | |||
| 20 | sub routes_action {# маршруты действия | ||
| 21 | my $self = ref($_[0]) ? shift : shift->new; | ||
| 22 | $self->dbh->selectall_arrayref($self->sth('action routes', where=>"where action_id=?"), { Slice => {} }, (shift)); | ||
| 23 | } | ||
| 24 | |||
| 25 | sub routes_action_null {# маршруты без действия | ||
| 26 | my $self = ref($_[0]) ? shift : shift->new; | ||
| 27 | $self->dbh->selectall_arrayref($self->sth('action routes', where=>"where action_id is null"), { Slice => {} }); | ||
| 28 | } | ||
| 29 | |||
| 30 | sub new_route { | ||
| 31 | my $self = ref($_[0]) ? shift : shift->new; | ||
| 32 | $self->dbh->selectrow_hashref($self->sth('new route'), undef, (@_)); | ||
| 33 | } | ||
| 34 | |||
| 35 | 1; | ||
| 36 | |||
| 37 | __DATA__ |