| 1 | package Daje::Plugin::Companies; | ||
| 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::Companies - Mojolicious Plugin | ||
| 9 | # | ||
| 10 | # SYNOPSIS | ||
| 11 | # ======== | ||
| 12 | # | ||
| 13 | # Mojolicious | ||
| 14 | # =========== | ||
| 15 | # | ||
| 16 | # $self->plugin('Companies'); | ||
| 17 | # | ||
| 18 | # Mojolicious::Lite | ||
| 19 | # ================= | ||
| 20 | # | ||
| 21 | # plugin 'Companies'; | ||
| 22 | # | ||
| 23 | # DESCRIPTION | ||
| 24 | # =========== | ||
| 25 | # | ||
| 26 | # Daje::Plugin::Companies is a Mojolicious plugin. | ||
| 27 | # | ||
| 28 | # METHODS | ||
| 29 | # ======= | ||
| 30 | # | ||
| 31 | # Daje::Plugin::Companies 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-01-18 17:00:53. | ||
| 60 | # It will not be touched by Daje Tools again. | ||
| 61 | |||
| 62 | # <!-- Autogenerated file 2026-01-18 17:00:53 --> | ||
| 63 | |||
| 64 | use Daje::Plugin::Companies::Routes; | ||
| 65 | use Daje::Plugin::Companies::Helpers; | ||
| 66 | use Daje::Database::Migrator; | ||
| 67 | use Daje::Helper::Companies::Load; | ||
| 68 | use Daje::Plugin::Companies::Authorities; | ||
| 69 | use Daje::Plugin::Companies::Languages; | ||
| 70 | |||
| 71 | our $VERSION = '0.01'; | ||
| 72 | |||
| 73 | sub register ($self, $app, $config) { | ||
| 74 | $app->log->debug("Daje::Plugin::Companies::register start"); | ||
| 75 | |||
| 76 | my $migration->{class} = 'Daje::Database::Companies'; | ||
| 77 | $migration->{name} = 'companies'; | ||
| 78 | $migration->{migration} = 1; | ||
| 79 | my $migrations; | ||
| 80 | push @{$migrations}, $migration; | ||
| 81 | try { | ||
| 82 | Daje::Database::Migrator->new( | ||
| 83 | pg => $app->pg, | ||
| 84 | migrations => $migrations, | ||
| 85 | )->migrate(); | ||
| 86 | } catch ($e) { | ||
| 87 | $app->log->error($e); | ||
| 88 | }; | ||
| 89 | |||
| 90 | $app->helper( | ||
| 91 | companies => sub { | ||
| 92 | state $login = Daje::Helper::Companies::Load->new( | ||
| 93 | db => $app->pg->db, | ||
| 94 | ) | ||
| 95 | } | ||
| 96 | ); | ||
| 97 | |||
| 98 | Daje::Plugin::Companies::Routes->new()->routes($app, $config); | ||
| 99 | Daje::Plugin::Companies::Helpers->new()->helpers($app, $config); | ||
| 100 | Daje::Plugin::Companies::Authorities->new( | ||
| 101 | db => $app->pg->db | ||
| 102 | )->authorize(); | ||
| 103 | Daje::Plugin::Companies::Languages->new( | ||
| 104 | db => $app->pg->db | ||
| 105 | )->language(); | ||
| 106 | my $r = $app->routes; | ||
| 107 | $r->put($app->config->{project} . '/api/try/load/company/')->to('CompaniesLoad#load_all_companies_for_user'); | ||
| 108 | $r->put($app->config->{project} . '/api/new/company/')->to('CompaniesSignup#signup'); | ||
| 109 | |||
| 110 | $app->log->debug("Daje::Plugin::Companies::register ends"); | ||
| 111 | } | ||
| 112 | |||
| 113 | 1; | ||
| 114 | |||
| 115 | |||
| 116 | |||
| 117 | #################### pod generated by Pod::Autopod - keep this line to make pod updates possible #################### | ||
| 118 | |||
| 119 | =head1 NAME | ||
| 120 | |||
| 121 | |||
| 122 | Daje::Plugin::Companies - Mojolicious Plugin | ||
| 123 | |||
| 124 | |||
| 125 | |||
| 126 | =head1 SYNOPSIS | ||
| 127 | |||
| 128 | |||
| 129 | |||
| 130 | |||
| 131 | =head1 DESCRIPTION | ||
| 132 | |||
| 133 | |||
| 134 | Daje::Plugin::Companies is a Mojolicious plugin. | ||
| 135 | |||
| 136 | |||
| 137 | |||
| 138 | =head1 REQUIRES | ||
| 139 | |||
| 140 | L<Daje::Database::Migrator> | ||
| 141 | |||
| 142 | L<Daje::Plugin::Companies::Helpers> | ||
| 143 | |||
| 144 | L<Daje::Plugin::Companies::Routes> | ||
| 145 | |||
| 146 | L<v5.42> | ||
| 147 | |||
| 148 | L<Mojo::Base> | ||
| 149 | |||
| 150 | |||
| 151 | =head1 METHODS | ||
| 152 | |||
| 153 | |||
| 154 | Daje::Plugin::Companies inherits all methods from | ||
| 155 | Mojolicious::Plugin and implements the following new ones. | ||
| 156 | |||
| 157 | |||
| 158 | |||
| 159 | =head1 register | ||
| 160 | |||
| 161 | $plugin->register(Mojolicious->new); | ||
| 162 | |||
| 163 | Register plugin in L<Mojolicious> application. | ||
| 164 | |||
| 165 | |||
| 166 | |||
| 167 | =head1 Mojolicious | ||
| 168 | |||
| 169 | |||
| 170 | $self->plugin('Companies'); | ||
| 171 | |||
| 172 | |||
| 173 | |||
| 174 | =head1 Mojolicious::Lite | ||
| 175 | |||
| 176 | |||
| 177 | plugin 'Companies'; | ||
| 178 | |||
| 179 | |||
| 180 | |||
| 181 | =head1 SEE ALSO | ||
| 182 | |||
| 183 | |||
| 184 | Mojolicious, Mojolicious::Guides, https://mojolicious.org. | ||
| 185 | |||
| 186 | |||
| 187 | |||
| 188 | =head1 AUTHOR | ||
| 189 | |||
| 190 | |||
| 191 | janeskil1525 E<lt>janeskil1525@gmail.com | ||
| 192 | |||
| 193 | |||
| 194 | |||
| 195 | =head1 LICENSE | ||
| 196 | |||
| 197 | |||
| 198 | Copyright (C) janeskil1525. | ||
| 199 | |||
| 200 | This library is free software; you can redistribute it and/or modify | ||
| 201 | it under the same terms as Perl itself. | ||
| 202 | |||
| 203 | |||
| 204 | |||
| 205 | =cut | ||
| 206 | |||