@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | |
4 | 4 | class CreateRolesToRightTable{ |
5 | 5 | /** |
6 | - * Do the migration |
|
7 | - */ |
|
6 | + * Do the migration |
|
7 | + */ |
|
8 | 8 | public function up() |
9 | 9 | { |
10 | 10 | Capsule::schema()->create('roles_to_rights', function($table) |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
20 | - * Undo the migration |
|
21 | - */ |
|
20 | + * Undo the migration |
|
21 | + */ |
|
22 | 22 | public function down() |
23 | 23 | { |
24 | 24 | Capsule::schema()->drop('roles_to_rights'); |
@@ -8,8 +8,7 @@ |
||
8 | 8 | */ |
9 | 9 | public function up() |
10 | 10 | { |
11 | - Capsule::schema()->create('users', function($table) |
|
12 | - { |
|
11 | + Capsule::schema()->create('users', function($table) { |
|
13 | 12 | $table->increments('id'); |
14 | 13 | $table->string('email')->unique(); |
15 | 14 | $table->string('full_name'); |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | |
4 | 4 | class CreateRolesToRightTable{ |
5 | 5 | /** |
6 | - * Do the migration |
|
7 | - */ |
|
6 | + * Do the migration |
|
7 | + */ |
|
8 | 8 | public function up() |
9 | 9 | { |
10 | 10 | Capsule::schema()->create('roles_to_rights', function($table) |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
20 | - * Undo the migration |
|
21 | - */ |
|
20 | + * Undo the migration |
|
21 | + */ |
|
22 | 22 | public function down() |
23 | 23 | { |
24 | 24 | Capsule::schema()->drop('roles_to_rights'); |
@@ -8,8 +8,7 @@ |
||
8 | 8 | */ |
9 | 9 | public function up() |
10 | 10 | { |
11 | - Capsule::schema()->create('logs', function($table) |
|
12 | - { |
|
11 | + Capsule::schema()->create('logs', function($table) { |
|
13 | 12 | $table->increments('id'); |
14 | 13 | $table->string('action'); |
15 | 14 | $table->morphs('entity'); |
@@ -12,8 +12,8 @@ |
||
12 | 12 | |
13 | 13 | public function actionIndex() |
14 | 14 | { |
15 | - echo 'This is sample console command.' . PHP_EOL; |
|
16 | - echo 'Actions: ' . PHP_EOL; |
|
17 | - echo 'partisan sample index' . PHP_EOL; |
|
15 | + echo 'This is sample console command.'.PHP_EOL; |
|
16 | + echo 'Actions: '.PHP_EOL; |
|
17 | + echo 'partisan sample index'.PHP_EOL; |
|
18 | 18 | } |
19 | 19 | } |
@@ -96,5 +96,5 @@ |
||
96 | 96 | | of "email". This simply helps us make messages a little cleaner. |
97 | 97 | | |
98 | 98 | */ |
99 | - 'attributes' => [ ], |
|
99 | + 'attributes' => [], |
|
100 | 100 | ]; |
101 | 101 | \ No newline at end of file |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | // monolog settings |
9 | 9 | 'logger' => [ |
10 | 10 | 'name' => 'app', |
11 | - 'path' => __DIR__ . '/../log/app.log', |
|
11 | + 'path' => __DIR__.'/../log/app.log', |
|
12 | 12 | ], |
13 | 13 | |
14 | - 'mailTemplate' => __DIR__ . '/../mail', |
|
14 | + 'mailTemplate' => __DIR__.'/../mail', |
|
15 | 15 | |
16 | 16 | // DB |
17 | - 'database' => require(__DIR__ . '/../config/db.php'), |
|
17 | + 'database' => require(__DIR__.'/../config/db.php'), |
|
18 | 18 | |
19 | 19 | // ACL |
20 | 20 | 'acl' => |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * specified here so can be used in the code if needs be |
31 | 31 | * Example: ['user' => null] |
32 | 32 | */ |
33 | - 'resources' => [ ], |
|
33 | + 'resources' => [], |
|
34 | 34 | // where we specify the guarding! |
35 | 35 | 'guards' => [ |
36 | 36 | /* |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * if included all resources default to deny unless specified. |
40 | 40 | * Example: ['user', ['admin']] |
41 | 41 | */ |
42 | - 'resources' => [ ], |
|
42 | + 'resources' => [], |
|
43 | 43 | /* |
44 | 44 | * list of literal routes for guarding. |
45 | 45 | * optional |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * ['route', ['roles'], ['methods',' methods1']] |
49 | 49 | */ |
50 | 50 | 'routes' => [ |
51 | - ['/api/token', ['guest'], ['post']], |
|
52 | - ['/api/user', ['user'], ['get']], |
|
51 | + ['/api/token', ['guest'], ['post']], |
|
52 | + ['/api/user', ['user'], ['get']], |
|
53 | 53 | ], |
54 | 54 | /* |
55 | 55 | * list of callables to resolve against |
@@ -59,27 +59,27 @@ discard block |
||
59 | 59 | * ['callable', ['roles']] |
60 | 60 | */ |
61 | 61 | 'callables' => [ |
62 | - ['App\Controller\CrudController', ['user']], |
|
63 | - ['App\Controller\CrudController:actionIndex', ['user']], |
|
64 | - ['App\Controller\CrudController:actionGet', ['user']], |
|
65 | - ['App\Controller\CrudController:actionCreate', ['user']], |
|
66 | - ['App\Controller\CrudController:actionUpdate', ['user']], |
|
67 | - ['App\Controller\CrudController:actionDelete', ['user']], |
|
62 | + ['App\Controller\CrudController', ['user']], |
|
63 | + ['App\Controller\CrudController:actionIndex', ['user']], |
|
64 | + ['App\Controller\CrudController:actionGet', ['user']], |
|
65 | + ['App\Controller\CrudController:actionCreate', ['user']], |
|
66 | + ['App\Controller\CrudController:actionUpdate', ['user']], |
|
67 | + ['App\Controller\CrudController:actionDelete', ['user']], |
|
68 | 68 | |
69 | - ['App\Controller\UserController:actionIndex', ['admin']], |
|
70 | - ['App\Controller\UserController:actionGet', ['admin']], |
|
69 | + ['App\Controller\UserController:actionIndex', ['admin']], |
|
70 | + ['App\Controller\UserController:actionGet', ['admin']], |
|
71 | 71 | ['App\Controller\UserController:actionCreate', ['admin']], |
72 | 72 | ['App\Controller\UserController:actionUpdate', ['admin']], |
73 | - ['App\Controller\UserController:actionDelete', ['user']], |
|
73 | + ['App\Controller\UserController:actionDelete', ['user']], |
|
74 | 74 | ] |
75 | 75 | ] |
76 | 76 | ], |
77 | 77 | |
78 | 78 | 'translate' => [ |
79 | - 'path' => __DIR__ . '/../lang', |
|
79 | + 'path' => __DIR__.'/../lang', |
|
80 | 80 | 'locale' => 'ru', |
81 | 81 | ], |
82 | 82 | |
83 | - 'params' => require(__DIR__ . '/../config/params.php'), |
|
83 | + 'params' => require(__DIR__.'/../config/params.php'), |
|
84 | 84 | ], |
85 | 85 | ]; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // Routes |
3 | -$app->group('/api', function () { |
|
4 | - $this->options('[/{params:.*}]', function ($request, $response) { |
|
3 | +$app->group('/api', function() { |
|
4 | + $this->options('[/{params:.*}]', function($request, $response) { |
|
5 | 5 | return $response->withHeader('Access-Control-Allow-Origin', '*') |
6 | 6 | ->withHeader('Access-Control-Allow-Methods', 'GET, PUT, PATCH, POST, DELETE, OPTIONS') |
7 | 7 | ->withHeader('Access-Control-Allow-Credentials', 'true') |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | $this->post('/token', 'App\Controller\TokenController:auth'); |
13 | 13 | |
14 | - $this->group('/{entity:user}', function () { |
|
14 | + $this->group('/{entity:user}', function() { |
|
15 | 15 | $this->get('', 'App\Controller\UserController:actionIndex'); |
16 | 16 | $this->post('', 'App\Controller\UserController:actionCreate'); |
17 | 17 | $this->get('/{id:[0-9]+}', 'App\Controller\UserController:actionGet'); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $this->post('/reset-password', 'App\Controller\UserController:actionResetPassword'); |
23 | 23 | }); |
24 | 24 | |
25 | - $this->group('/{entity:role|right}', function () { |
|
25 | + $this->group('/{entity:role|right}', function() { |
|
26 | 26 | $this->get('', 'App\Controller\CrudController:actionIndex'); |
27 | 27 | $this->get('/{id:[0-9]+}', 'App\Controller\CrudController:actionGet'); |
28 | 28 | $this->post('', 'App\Controller\CrudController:actionCreate'); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $this->delete('/{id:[0-9]+}', 'App\Controller\CrudController:actionDelete'); |
31 | 31 | }); |
32 | 32 | |
33 | - $this->group('/{entity:log}', function () { |
|
33 | + $this->group('/{entity:log}', function() { |
|
34 | 34 | $this->get('', 'App\Controller\CrudController:actionIndex'); |
35 | 35 | $this->get('/{id:[0-9]+}', 'App\Controller\CrudController:actionGet'); |
36 | 36 | }); |
@@ -22,20 +22,20 @@ discard block |
||
22 | 22 | $container = $app->getContainer(); |
23 | 23 | |
24 | 24 | // render |
25 | -$container['renderer'] = function(){ |
|
25 | +$container['renderer'] = function() { |
|
26 | 26 | $renderer = new Renderer(); |
27 | 27 | |
28 | 28 | return $renderer; |
29 | 29 | }; |
30 | 30 | |
31 | -$container['mailRenderer'] = function($c){ |
|
31 | +$container['mailRenderer'] = function($c) { |
|
32 | 32 | $settings = $c->get('settings'); |
33 | 33 | $renderer = new MailRenderer($settings['mailTemplate']); |
34 | 34 | return $renderer; |
35 | 35 | }; |
36 | 36 | |
37 | 37 | // monolog |
38 | -$container['logger'] = function ($c) { |
|
38 | +$container['logger'] = function($c) { |
|
39 | 39 | $settings = $c->get('settings'); |
40 | 40 | $logger = new Logger($settings['logger']['name']); |
41 | 41 | $logger->pushProcessor(new UidProcessor()); |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | }; |
46 | 46 | |
47 | 47 | // error handlers |
48 | -$container['errorHandler'] = function ($c) { |
|
49 | - return function ($request, $response, $exception) use ($c) { |
|
48 | +$container['errorHandler'] = function($c) { |
|
49 | + return function($request, $response, $exception) use ($c) { |
|
50 | 50 | $details = (defined('DEBUG_MODE') && DEBUG_MODE == 1) ? $exception->getMessage() : 'Internal server error'; |
51 | 51 | $e = new JsonException(null, 500, 'Internal server error', $details); |
52 | 52 | |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | }; |
55 | 55 | }; |
56 | 56 | |
57 | -$container['notAllowedHandler'] = function ($c) { |
|
58 | - return function ($request, $response, $methods) use ($c) { |
|
59 | - throw new JsonException(null, 405, 'Method Not Allowed', 'Method must be one of: ' . implode(', ', $methods)); |
|
57 | +$container['notAllowedHandler'] = function($c) { |
|
58 | + return function($request, $response, $methods) use ($c) { |
|
59 | + throw new JsonException(null, 405, 'Method Not Allowed', 'Method must be one of: '.implode(', ', $methods)); |
|
60 | 60 | }; |
61 | 61 | }; |
62 | 62 | |
63 | -$container['notFoundHandler'] = function ($c) { |
|
64 | - return function () use ($c) { |
|
63 | +$container['notFoundHandler'] = function($c) { |
|
64 | + return function() use ($c) { |
|
65 | 65 | throw new JsonException(null, 404, 'Not found', 'Entity not found'); |
66 | 66 | }; |
67 | 67 | }; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | // database |
70 | 70 | $setting = $container['settings']; |
71 | 71 | $capsule = new Capsule; |
72 | -foreach ($setting['database']['connections'] as $name => $connection){ |
|
72 | +foreach ($setting['database']['connections'] as $name => $connection) { |
|
73 | 73 | $capsule->addConnection($connection, $name); |
74 | 74 | } |
75 | 75 | $capsule->setEventDispatcher(new Dispatcher(new Container)); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $container['databaseManager'] = $capsule->getDatabaseManager(); |
80 | 80 | |
81 | 81 | // ACL |
82 | -$container['acl'] = function ($c) { |
|
82 | +$container['acl'] = function($c) { |
|
83 | 83 | $settings = $c->get('settings'); |
84 | 84 | $acl = new Acl($settings['acl']); |
85 | 85 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | }; |
88 | 88 | |
89 | 89 | // translation |
90 | -$container['translator'] = function($c){ |
|
90 | +$container['translator'] = function($c) { |
|
91 | 91 | $settings = $c->get('settings'); |
92 | 92 | $translation_file_loader = new FileLoader(new Filesystem, $settings['translate']['path']); |
93 | 93 | $translator = new Translator($translation_file_loader, $settings['translate']['locale']); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | }; |
97 | 97 | |
98 | 98 | // validation |
99 | -$container['validation'] = function($c){ |
|
99 | +$container['validation'] = function($c) { |
|
100 | 100 | $translator = $c->get('translator'); |
101 | 101 | $validation = new Factory($translator); |
102 | 102 | $presence = new DatabasePresenceVerifier($c->get('databaseManager')); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | }; |
107 | 107 | |
108 | 108 | // mailer |
109 | -$container['mailer'] = function(){ |
|
109 | +$container['mailer'] = function() { |
|
110 | 110 | $transport = \Swift_MailTransport::newInstance(); |
111 | 111 | $mailer = \Swift_Mailer::newInstance($transport); |
112 | 112 |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | $container = $app->getContainer(); |
23 | 23 | |
24 | 24 | // render |
25 | -$container['renderer'] = function(){ |
|
25 | +$container['renderer'] = function() { |
|
26 | 26 | $renderer = new Renderer(); |
27 | 27 | |
28 | 28 | return $renderer; |
29 | 29 | }; |
30 | 30 | |
31 | -$container['mailRenderer'] = function($c){ |
|
31 | +$container['mailRenderer'] = function($c) { |
|
32 | 32 | $settings = $c->get('settings'); |
33 | 33 | $renderer = new MailRenderer($settings['mailTemplate']); |
34 | 34 | return $renderer; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | // database |
70 | 70 | $setting = $container['settings']; |
71 | 71 | $capsule = new Capsule; |
72 | -foreach ($setting['database']['connections'] as $name => $connection){ |
|
72 | +foreach ($setting['database']['connections'] as $name => $connection) { |
|
73 | 73 | $capsule->addConnection($connection, $name); |
74 | 74 | } |
75 | 75 | $capsule->setEventDispatcher(new Dispatcher(new Container)); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | }; |
88 | 88 | |
89 | 89 | // translation |
90 | -$container['translator'] = function($c){ |
|
90 | +$container['translator'] = function($c) { |
|
91 | 91 | $settings = $c->get('settings'); |
92 | 92 | $translation_file_loader = new FileLoader(new Filesystem, $settings['translate']['path']); |
93 | 93 | $translator = new Translator($translation_file_loader, $settings['translate']['locale']); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | }; |
97 | 97 | |
98 | 98 | // validation |
99 | -$container['validation'] = function($c){ |
|
99 | +$container['validation'] = function($c) { |
|
100 | 100 | $translator = $c->get('translator'); |
101 | 101 | $validation = new Factory($translator); |
102 | 102 | $presence = new DatabasePresenceVerifier($c->get('databaseManager')); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | }; |
107 | 107 | |
108 | 108 | // mailer |
109 | -$container['mailer'] = function(){ |
|
109 | +$container['mailer'] = function() { |
|
110 | 110 | $transport = \Swift_MailTransport::newInstance(); |
111 | 111 | $mailer = \Swift_Mailer::newInstance($transport); |
112 | 112 |