| 1 | package Daje::Plugin::Authorities; | ||
| 2 | 0 | ▶ | use Mojo::Base 'Mojolicious::Plugin', -base, -signatures; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 3 | use v5.42; | ||
| 4 | |||
| 5 | # NAME | ||
| 6 | # ==== | ||
| 7 | # | ||
| 8 | # Daje::Plugin::Authorities - Mojolicious Plugin | ||
| 9 | # | ||
| 10 | # SYNOPSIS | ||
| 11 | # ======== | ||
| 12 | # | ||
| 13 | # Mojolicious | ||
| 14 | # =========== | ||
| 15 | # | ||
| 16 | # $self->plugin('Authorities'); | ||
| 17 | # | ||
| 18 | # Mojolicious::Lite | ||
| 19 | # ================= | ||
| 20 | # | ||
| 21 | # plugin 'Authorities'; | ||
| 22 | # | ||
| 23 | # DESCRIPTION | ||
| 24 | # =========== | ||
| 25 | # | ||
| 26 | # Daje::Plugin::Authorities is a Mojolicious plugin. | ||
| 27 | # | ||
| 28 | # METHODS | ||
| 29 | # ======= | ||
| 30 | # | ||
| 31 | # Daje::Plugin::Authorities inherits all methods from | ||
| 32 | # Mojolicious::Plugin and implements the following new ones. | ||
| 33 | # | ||
| 34 | # register | ||
| 35 | # ======== | ||
| 36 | # $plugin->register(Mojolicious->new); | ||
| 37 | # | ||
| 38 | # Register plugin in L<Mojolicious> application. | ||
| 39 | # | ||
| 40 | # SEE ALSO | ||
| 41 | # ======== | ||
| 42 | # | ||
| 43 | # Mojolicious, Mojolicious::Guides, https://mojolicious.org. | ||
| 44 | # | ||
| 45 | # LICENSE | ||
| 46 | # ======= | ||
| 47 | # | ||
| 48 | # Copyright (C) janeskil1525. | ||
| 49 | # | ||
| 50 | # This library is free software; you can redistribute it and/or modify | ||
| 51 | # it under the same terms as Perl itself. | ||
| 52 | # | ||
| 53 | # AUTHOR | ||
| 54 | # ====== | ||
| 55 | # | ||
| 56 | # janeskil1525 E<lt>janeskil1525@gmail.com | ||
| 57 | # | ||
| 58 | |||
| 59 | # This file is generated once automatically by Daje Tools 2026-02-12 04:22:51. | ||
| 60 | # It will not be touched by Daje Tools again. | ||
| 61 | |||
| 62 | # <!-- Autogenerated file 2026-02-12 04:22:51 --> | ||
| 63 | |||
| 64 | use Daje::Plugin::Authorities::Routes; | ||
| 65 | use Daje::Plugin::Authorities::Helpers; | ||
| 66 | use Daje::Plugin::Authorities::Authorities; | ||
| 67 | use Daje::Plugin::Authorities::Languages; | ||
| 68 | use Daje::Database::Migrator; | ||
| 69 | |||
| 70 | our $VERSION = '0.01'; | ||
| 71 | |||
| 72 | sub register ($self, $app, $config) { | ||
| 73 | $app->log->debug("Daje::Plugin::Authorities::register start"); | ||
| 74 | |||
| 75 | my $migration->{class} = 'Daje::Database::Authorities'; | ||
| 76 | $migration->{name} = 'authorities'; | ||
| 77 | $migration->{migration} = 1; | ||
| 78 | my $migrations; | ||
| 79 | push @{$migrations}, $migration; | ||
| 80 | try { | ||
| 81 | Daje::Database::Migrator->new( | ||
| 82 | pg => $app->pg, | ||
| 83 | migrations => $migrations, | ||
| 84 | )->migrate(); | ||
| 85 | } catch ($e) { | ||
| 86 | $app->log->error($e); | ||
| 87 | }; | ||
| 88 | |||
| 89 | Daje::Plugin::Authorities::Routes->new()->routes($app, $config); | ||
| 90 | Daje::Plugin::Authorities::Helpers->new()->helpers($app, $config); | ||
| 91 | Daje::Plugin::Authorities::Authorities->new(db => $app->pg->db)->authorize(); | ||
| 92 | Daje::Plugin::Authorities::Languages->new( | ||
| 93 | db => $app->pg->db | ||
| 94 | )->language(); | ||
| 95 | |||
| 96 | |||
| 97 | $app->log->debug("Daje::Plugin::Authorities::register ends"); | ||
| 98 | } | ||
| 99 | |||
| 100 | 1; | ||
| 101 | |||
| 102 | |||
| 103 | #################### pod generated by Pod::Autopod - keep this line to make pod updates possible #################### | ||
| 104 | |||
| 105 | =head1 NAME | ||
| 106 | |||
| 107 | |||
| 108 | Daje::Plugin::Authorities - Mojolicious Plugin | ||
| 109 | |||
| 110 | |||
| 111 | |||
| 112 | =head1 SYNOPSIS | ||
| 113 | |||
| 114 | |||
| 115 | |||
| 116 | |||
| 117 | =head1 DESCRIPTION | ||
| 118 | |||
| 119 | |||
| 120 | Daje::Plugin::Authorities is a Mojolicious plugin. | ||
| 121 | |||
| 122 | |||
| 123 | |||
| 124 | =head1 REQUIRES | ||
| 125 | |||
| 126 | L<Daje::Database::Migrator> | ||
| 127 | |||
| 128 | L<Daje::Plugin::Authorities::Authorities> | ||
| 129 | |||
| 130 | L<Daje::Plugin::Authorities::Helpers> | ||
| 131 | |||
| 132 | L<Daje::Plugin::Authorities::Routes> | ||
| 133 | |||
| 134 | L<v5.42> | ||
| 135 | |||
| 136 | L<Mojo::Base> | ||
| 137 | |||
| 138 | |||
| 139 | =head1 METHODS | ||
| 140 | |||
| 141 | |||
| 142 | Daje::Plugin::Authorities inherits all methods from | ||
| 143 | Mojolicious::Plugin and implements the following new ones. | ||
| 144 | |||
| 145 | |||
| 146 | |||
| 147 | =head1 Mojolicious | ||
| 148 | |||
| 149 | |||
| 150 | $self->plugin('Authorities'); | ||
| 151 | |||
| 152 | |||
| 153 | |||
| 154 | =head1 register | ||
| 155 | |||
| 156 | $plugin->register(Mojolicious->new); | ||
| 157 | |||
| 158 | Register plugin in L<Mojolicious> application. | ||
| 159 | |||
| 160 | |||
| 161 | |||
| 162 | =head1 Mojolicious::Lite | ||
| 163 | |||
| 164 | |||
| 165 | plugin 'Authorities'; | ||
| 166 | |||
| 167 | |||
| 168 | |||
| 169 | =head1 SEE ALSO | ||
| 170 | |||
| 171 | |||
| 172 | Mojolicious, Mojolicious::Guides, https://mojolicious.org. | ||
| 173 | |||
| 174 | |||
| 175 | |||
| 176 | =head1 AUTHOR | ||
| 177 | |||
| 178 | |||
| 179 | janeskil1525 E<lt>janeskil1525@gmail.com | ||
| 180 | |||
| 181 | |||
| 182 | |||
| 183 | =head1 LICENSE | ||
| 184 | |||
| 185 | |||
| 186 | Copyright (C) janeskil1525. | ||
| 187 | |||
| 188 | This library is free software; you can redistribute it and/or modify | ||
| 189 | it under the same terms as Perl itself. | ||
| 190 | |||
| 191 | |||
| 192 | |||
| 193 | =cut | ||
| 194 | |||