@@ -6,8 +6,8 @@ |
||
| 6 | 6 | |
| 7 | 7 | $app = new Application(); |
| 8 | 8 | $app->setConfigPath(__DIR__ . '/../config') |
| 9 | - ->setAppPath(dirname(__DIR__)) |
|
| 10 | - ->setVendorPath(dirname(__DIR__) . '/../../vendor'); |
|
| 9 | + ->setAppPath(dirname(__DIR__)) |
|
| 10 | + ->setVendorPath(dirname(__DIR__) . '/../../vendor'); |
|
| 11 | 11 | |
| 12 | 12 | /** @var HttpKernel $kernel */ |
| 13 | 13 | $kernel = $app->make(HttpKernel::class); |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | $config = $app->get(Config::class); |
| 88 | 88 | |
| 89 | 89 | $pagination->setItemsPerPage($config->get('pagination.item_per_page', 10)) |
| 90 | - ->setMaxPages($config->get('pagination.max_pages', 5)); |
|
| 90 | + ->setMaxPages($config->get('pagination.max_pages', 5)); |
|
| 91 | 91 | |
| 92 | 92 | return $pagination; |
| 93 | 93 | }); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | ) { |
| 75 | 75 | parent::__construct($application, $filesystem); |
| 76 | 76 | $this->setName('make:action') |
| 77 | - ->setDescription('Command to generate new request handler class'); |
|
| 77 | + ->setDescription('Command to generate new request handler class'); |
|
| 78 | 78 | |
| 79 | 79 | $this->addOption('-o|--overwrite', 'Overwrite existing files.', false, false); |
| 80 | 80 | } |
@@ -85,31 +85,3 @@ discard block |
||
| 85 | 85 | public function getClassTemplate(): string |
| 86 | 86 | { |
| 87 | 87 | return <<<EOF |
| 88 | - <?php |
|
| 89 | - |
|
| 90 | - declare(strict_types=1); |
|
| 91 | - |
|
| 92 | - namespace %namespace%; |
|
| 93 | - |
|
| 94 | - use Platine\Http\Handler\RequestHandlerInterface; |
|
| 95 | - use Platine\Http\ResponseInterface; |
|
| 96 | - use Platine\Http\ServerRequestInterface; |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * @class %classname% |
|
| 100 | - * @package %namespace% |
|
| 101 | - */ |
|
| 102 | - class %classname% implements RequestHandlerInterface |
|
| 103 | - { |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * {@inheritodc} |
|
| 107 | - */ |
|
| 108 | - public function handle(ServerRequestInterface \$request): ResponseInterface |
|
| 109 | - { |
|
| 110 | - } |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - EOF; |
|
| 114 | - } |
|
| 115 | -} |
|
@@ -124,16 +124,16 @@ |
||
| 124 | 124 | ->count('id'); |
| 125 | 125 | $currentPage = (int)$param->get('page', 1); |
| 126 | 126 | $this->pagination->setTotalItems($totalItems) |
| 127 | - ->setCurrentPage($currentPage); |
|
| 127 | + ->setCurrentPage($currentPage); |
|
| 128 | 128 | $limit = $this->pagination->getItemsPerPage(); |
| 129 | 129 | $offset = $this->pagination->getOffset(); |
| 130 | 130 | ////////// END PAGINATION ////////////////// |
| 131 | 131 | |
| 132 | 132 | $users = $this->userRepository |
| 133 | - ->limit($offset, $limit) |
|
| 134 | - ->orderBy(['lastname', 'firstname']) |
|
| 135 | - ->filters($filters) |
|
| 136 | - ->all(); |
|
| 133 | + ->limit($offset, $limit) |
|
| 134 | + ->orderBy(['lastname', 'firstname']) |
|
| 135 | + ->filters($filters) |
|
| 136 | + ->all(); |
|
| 137 | 137 | |
| 138 | 138 | $statusList = [ |
| 139 | 139 | 'D' => 'Deactive', |
@@ -181,9 +181,9 @@ |
||
| 181 | 181 | $this->logger->info('Deleted of users #{items}', ['items' => $items]); |
| 182 | 182 | |
| 183 | 183 | $this->userRepository->query() |
| 184 | - ->where('id') |
|
| 184 | + ->where('id') |
|
| 185 | 185 | ->in($items) |
| 186 | - ->delete(); |
|
| 186 | + ->delete(); |
|
| 187 | 187 | |
| 188 | 188 | $this->session->setFlash('success', $this->lang->tr('The selected users are deleted successfully')); |
| 189 | 189 | } |
@@ -107,17 +107,17 @@ |
||
| 107 | 107 | |
| 108 | 108 | ////////// BEGIN PAGINATION ////////////////// |
| 109 | 109 | $totalItems = $this->permissionRepository->query() |
| 110 | - ->count('id'); |
|
| 110 | + ->count('id'); |
|
| 111 | 111 | $currentPage = (int)$param->get('page', 1); |
| 112 | 112 | $this->pagination->setTotalItems($totalItems) |
| 113 | - ->setCurrentPage($currentPage); |
|
| 113 | + ->setCurrentPage($currentPage); |
|
| 114 | 114 | $limit = $this->pagination->getItemsPerPage(); |
| 115 | 115 | $offset = $this->pagination->getOffset(); |
| 116 | 116 | ////////// END PAGINATION ////////////////// |
| 117 | 117 | |
| 118 | 118 | $permissions = $this->permissionRepository->limit($offset, $limit) |
| 119 | - ->orderBy('code') |
|
| 120 | - ->all(); |
|
| 119 | + ->orderBy('code') |
|
| 120 | + ->all(); |
|
| 121 | 121 | return new TemplateResponse( |
| 122 | 122 | $this->template, |
| 123 | 123 | 'permission/list', |
@@ -109,14 +109,14 @@ |
||
| 109 | 109 | ->count('id'); |
| 110 | 110 | $currentPage = (int)$param->get('page', 1); |
| 111 | 111 | $this->pagination->setTotalItems($totalItems) |
| 112 | - ->setCurrentPage($currentPage); |
|
| 112 | + ->setCurrentPage($currentPage); |
|
| 113 | 113 | $limit = $this->pagination->getItemsPerPage(); |
| 114 | 114 | $offset = $this->pagination->getOffset(); |
| 115 | 115 | ////////// END PAGINATION ////////////////// |
| 116 | 116 | |
| 117 | 117 | $roles = $this->roleRepository |
| 118 | - ->limit($offset, $limit) |
|
| 119 | - ->all(); |
|
| 118 | + ->limit($offset, $limit) |
|
| 119 | + ->all(); |
|
| 120 | 120 | |
| 121 | 121 | return new TemplateResponse( |
| 122 | 122 | $this->template, |
@@ -100,37 +100,37 @@ |
||
| 100 | 100 | public function setRules(): void |
| 101 | 101 | { |
| 102 | 102 | $this->validator->addRules('username', [ |
| 103 | - new NotEmpty(), |
|
| 104 | - new MinLength(3), |
|
| 105 | - new AlphaDash() |
|
| 103 | + new NotEmpty(), |
|
| 104 | + new MinLength(3), |
|
| 105 | + new AlphaDash() |
|
| 106 | 106 | ]); |
| 107 | 107 | |
| 108 | 108 | $this->validator->addRules('lastname', [ |
| 109 | - new NotEmpty(), |
|
| 110 | - new MinLength(3) |
|
| 109 | + new NotEmpty(), |
|
| 110 | + new MinLength(3) |
|
| 111 | 111 | ]); |
| 112 | 112 | |
| 113 | 113 | $this->validator->addRules('firstname', [ |
| 114 | - new NotEmpty(), |
|
| 115 | - new MinLength(3) |
|
| 114 | + new NotEmpty(), |
|
| 115 | + new MinLength(3) |
|
| 116 | 116 | ]); |
| 117 | 117 | |
| 118 | 118 | $this->validator->addRules('status', [ |
| 119 | - new NotEmpty(), |
|
| 120 | - new InList(['A', 'D']) |
|
| 119 | + new NotEmpty(), |
|
| 120 | + new InList(['A', 'D']) |
|
| 121 | 121 | ]); |
| 122 | 122 | |
| 123 | 123 | $this->validator->addRules('email', [ |
| 124 | - new NotEmpty(), |
|
| 125 | - new Email() |
|
| 124 | + new NotEmpty(), |
|
| 125 | + new Email() |
|
| 126 | 126 | ]); |
| 127 | 127 | |
| 128 | 128 | $this->validator->addRules('role', [ |
| 129 | - new MinLength(3) |
|
| 129 | + new MinLength(3) |
|
| 130 | 130 | ]); |
| 131 | 131 | |
| 132 | 132 | $this->validator->addRules('password', [ |
| 133 | - new MinLength(5), |
|
| 133 | + new MinLength(5), |
|
| 134 | 134 | ]); |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -79,8 +79,8 @@ |
||
| 79 | 79 | foreach ($pages as $page) { |
| 80 | 80 | if ($page->getUrl() !== null) { |
| 81 | 81 | $html .= '<li class = "page-item' . ($page->isCurrent() ? ' active"' : '"') |
| 82 | - . '><a href = "' . $page->getUrl() . '" class="page-link">' |
|
| 83 | - . $page->getNumber() . '</a></li>'; |
|
| 82 | + . '><a href = "' . $page->getUrl() . '" class="page-link">' |
|
| 83 | + . $page->getNumber() . '</a></li>'; |
|
| 84 | 84 | } else { |
| 85 | 85 | $html .= '<li class = "page-item disabled"><a href="#" class="page-link">' |
| 86 | 86 | . $page->getNumber() . '</a></li>'; |