| 1 | package Mojolicious::Plugin::RoutesAuthDBI::Model::Actions; | ||
| 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 access { | ||
| 10 | my $self = ref($_[0]) ? shift : shift->new; | ||
| 11 | $self->dbh->selectrow_array($self->sth('access action'), undef, ( @_ )); | ||
| 12 | } | ||
| 13 | |||
| 14 | sub actions { | ||
| 15 | my $self = ref($_[0]) ? shift : shift->new; | ||
| 16 | |||
| 17 | $self->dbh->selectall_arrayref($self->sth('actions'), { Slice => {} }, ); | ||
| 18 | } | ||
| 19 | |||
| 20 | sub actions_controller { | ||
| 21 | my $self = ref($_[0]) ? shift : shift->new; | ||
| 22 | |||
| 23 | $self->dbh->selectall_arrayref($self->sth('actions', where=>"where controller_id=?"), { Slice => {} }, (shift)); | ||
| 24 | } | ||
| 25 | |||
| 26 | sub action_controller { | ||
| 27 | my $self = ref($_[0]) ? shift : shift->new; | ||
| 28 | |||
| 29 | $self->dbh->selectrow_hashref($self->sth('actions', where=>"where controller_id=? and (a.id = ? or a.action = ? )"), undef, (@_)); | ||
| 30 | } | ||
| 31 | |||
| 32 | sub action_controller_null {# дествие с пустым контроллером | ||
| 33 | my $self = ref($_[0]) ? shift : shift->new; | ||
| 34 | |||
| 35 | $self->dbh->selectrow_hashref($self->sth('actions', where=>"where controller_id is null and (a.id = ? or a.action = ? )"), undef, (@_)); | ||
| 36 | } | ||
| 37 | |||
| 38 | sub actions_controller_null { | ||
| 39 | my $self = ref($_[0]) ? shift : shift->new; | ||
| 40 | |||
| 41 | $self->dbh->selectall_arrayref($self->sth('actions', where=>"where controller_id is null"), { Slice => {} },); | ||
| 42 | } | ||
| 43 | |||
| 44 | sub new_action { | ||
| 45 | my $self = ref($_[0]) ? shift : shift->new; | ||
| 46 | $self->dbh->selectrow_hashref($self->sth('new action'), undef, (@_)) | ||
| 47 | } | ||
| 48 | |||
| 49 | 1; | ||
| 50 | |||
| 51 | __DATA__ |