@@ -15,15 +15,13 @@ |
||
| 15 | 15 | * |
| 16 | 16 | * @author tony |
| 17 | 17 | */ |
| 18 | -class RedirectResponse extends Response |
|
| 19 | -{ |
|
| 18 | +class RedirectResponse extends Response { |
|
| 20 | 19 | |
| 21 | 20 | /** |
| 22 | 21 | * Create new instance |
| 23 | 22 | * @param string $url |
| 24 | 23 | */ |
| 25 | - public function __construct(string $url = '/') |
|
| 26 | - { |
|
| 24 | + public function __construct(string $url = '/') { |
|
| 27 | 25 | parent::__construct(302); |
| 28 | 26 | $this->headers['Location'] = [$url]; |
| 29 | 27 | } |
@@ -61,8 +61,7 @@ |
||
| 61 | 61 | * class UserServiceProvider |
| 62 | 62 | * @package Platine\Framework |
| 63 | 63 | */ |
| 64 | -class UserServiceProvider extends ServiceProvider |
|
| 65 | -{ |
|
| 64 | +class UserServiceProvider extends ServiceProvider { |
|
| 66 | 65 | |
| 67 | 66 | /** |
| 68 | 67 | * {@inheritdoc} |
@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | * class DbConfig |
| 55 | 55 | * @package Platine\Framework\Config |
| 56 | 56 | */ |
| 57 | -class DbConfig extends Config |
|
| 58 | -{ |
|
| 57 | +class DbConfig extends Config { |
|
| 59 | 58 | |
| 60 | 59 | /** |
| 61 | 60 | * The Query Builder instance |
@@ -68,8 +67,7 @@ discard block |
||
| 68 | 67 | * @param QueryBuilder $queryBuilder |
| 69 | 68 | * @param string $env |
| 70 | 69 | */ |
| 71 | - public function __construct(QueryBuilder $queryBuilder, string $env = '') |
|
| 72 | - { |
|
| 70 | + public function __construct(QueryBuilder $queryBuilder, string $env = '') { |
|
| 73 | 71 | $this->queryBuilder = $queryBuilder; |
| 74 | 72 | parent::__construct(new DatabaseConfigLoader($queryBuilder, 'config'), $env); |
| 75 | 73 | } |
@@ -92,13 +92,13 @@ discard block |
||
| 92 | 92 | $environments = $this->parse($environment); |
| 93 | 93 | foreach ($environments as $env) { |
| 94 | 94 | $results = $this->queryBuilder |
| 95 | - ->from($this->table) |
|
| 96 | - ->where('env')->is($env) |
|
| 97 | - ->where('module')->is($group) |
|
| 98 | - ->where('status')->is(1) |
|
| 99 | - ->select() |
|
| 100 | - ->fetchObject() |
|
| 101 | - ->all(); |
|
| 95 | + ->from($this->table) |
|
| 96 | + ->where('env')->is($env) |
|
| 97 | + ->where('module')->is($group) |
|
| 98 | + ->where('status')->is(1) |
|
| 99 | + ->select() |
|
| 100 | + ->fetchObject() |
|
| 101 | + ->all(); |
|
| 102 | 102 | |
| 103 | 103 | if ($results) { |
| 104 | 104 | $config = []; |
@@ -153,13 +153,13 @@ discard block |
||
| 153 | 153 | foreach ($results as $cfg) { |
| 154 | 154 | if ($cfg->parent) { |
| 155 | 155 | $results = $this->queryBuilder |
| 156 | - ->from($this->table) |
|
| 157 | - ->where('env')->is($cfg->env) |
|
| 158 | - ->where('module')->is($cfg->parent) |
|
| 159 | - ->where('status')->is(1) |
|
| 160 | - ->select() |
|
| 161 | - ->fetchObject() |
|
| 162 | - ->all(); |
|
| 156 | + ->from($this->table) |
|
| 157 | + ->where('env')->is($cfg->env) |
|
| 158 | + ->where('module')->is($cfg->parent) |
|
| 159 | + ->where('status')->is(1) |
|
| 160 | + ->select() |
|
| 161 | + ->fetchObject() |
|
| 162 | + ->all(); |
|
| 163 | 163 | |
| 164 | 164 | foreach ($results as $cfg) { |
| 165 | 165 | $config[$cfg->name] = $cfg->value ?? $cfg->default_value; |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | */ |
| 123 | 123 | protected function parse(string $env): array |
| 124 | 124 | { |
| 125 | - $environments = array_filter((array)preg_split('/(\/|\.)/', $env)); |
|
| 125 | + $environments = array_filter((array) preg_split('/(\/|\.)/', $env)); |
|
| 126 | 126 | array_unshift($environments, ''); |
| 127 | 127 | |
| 128 | 128 | return $environments; |
@@ -54,8 +54,7 @@ |
||
| 54 | 54 | * class DatabaseConfigLoader |
| 55 | 55 | * @package Platine\Framework\Config |
| 56 | 56 | */ |
| 57 | -class DatabaseConfigLoader implements LoaderInterface |
|
| 58 | -{ |
|
| 57 | +class DatabaseConfigLoader implements LoaderInterface { |
|
| 59 | 58 | |
| 60 | 59 | /** |
| 61 | 60 | * The QueryBuilder instance |
@@ -9,44 +9,44 @@ |
||
| 9 | 9 | |
| 10 | 10 | public function up(): void |
| 11 | 11 | { |
| 12 | - //Action when migrate up |
|
| 13 | - $this->create('config', function (CreateTable $table) { |
|
| 14 | - $table->integer('id') |
|
| 15 | - ->autoincrement() |
|
| 16 | - ->primary(); |
|
| 17 | - $table->string('env') |
|
| 18 | - ->description('The config environment') |
|
| 19 | - ->index(); |
|
| 20 | - $table->string('module') |
|
| 21 | - ->description('The module') |
|
| 22 | - ->index(); |
|
| 23 | - $table->string('code') |
|
| 24 | - ->description('The config code') |
|
| 25 | - ->notNull() |
|
| 26 | - ->index(); |
|
| 27 | - $table->string('value') |
|
| 28 | - ->description('The config value'); |
|
| 29 | - $table->string('type') |
|
| 30 | - ->description('The config data type'); |
|
| 31 | - $table->text('comment') |
|
| 32 | - ->description('The config description'); |
|
| 33 | - $table->integer('status') |
|
| 34 | - ->description('The config status') |
|
| 35 | - ->defaultValue(0) |
|
| 36 | - ->notNull(); |
|
| 37 | - $table->datetime('created_at') |
|
| 38 | - ->description('role created at') |
|
| 39 | - ->notNull(); |
|
| 40 | - $table->datetime('updated_at') |
|
| 41 | - ->description('role updated at'); |
|
| 12 | + //Action when migrate up |
|
| 13 | + $this->create('config', function (CreateTable $table) { |
|
| 14 | + $table->integer('id') |
|
| 15 | + ->autoincrement() |
|
| 16 | + ->primary(); |
|
| 17 | + $table->string('env') |
|
| 18 | + ->description('The config environment') |
|
| 19 | + ->index(); |
|
| 20 | + $table->string('module') |
|
| 21 | + ->description('The module') |
|
| 22 | + ->index(); |
|
| 23 | + $table->string('code') |
|
| 24 | + ->description('The config code') |
|
| 25 | + ->notNull() |
|
| 26 | + ->index(); |
|
| 27 | + $table->string('value') |
|
| 28 | + ->description('The config value'); |
|
| 29 | + $table->string('type') |
|
| 30 | + ->description('The config data type'); |
|
| 31 | + $table->text('comment') |
|
| 32 | + ->description('The config description'); |
|
| 33 | + $table->integer('status') |
|
| 34 | + ->description('The config status') |
|
| 35 | + ->defaultValue(0) |
|
| 36 | + ->notNull(); |
|
| 37 | + $table->datetime('created_at') |
|
| 38 | + ->description('role created at') |
|
| 39 | + ->notNull(); |
|
| 40 | + $table->datetime('updated_at') |
|
| 41 | + ->description('role updated at'); |
|
| 42 | 42 | |
| 43 | - $table->engine('INNODB'); |
|
| 44 | - }); |
|
| 43 | + $table->engine('INNODB'); |
|
| 44 | + }); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public function down(): void |
| 48 | 48 | { |
| 49 | - //Action when migrate down |
|
| 50 | - $this->drop('config'); |
|
| 49 | + //Action when migrate down |
|
| 50 | + $this->drop('config'); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | \ No newline at end of file |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | public function up(): void |
| 11 | 11 | { |
| 12 | 12 | //Action when migrate up |
| 13 | - $this->create('config', function (CreateTable $table) { |
|
| 13 | + $this->create('config', function(CreateTable $table) { |
|
| 14 | 14 | $table->integer('id') |
| 15 | 15 | ->autoincrement() |
| 16 | 16 | ->primary(); |
@@ -4,8 +4,7 @@ |
||
| 4 | 4 | use Platine\Database\Schema\CreateTable; |
| 5 | 5 | use Platine\Framework\Migration\AbstractMigration; |
| 6 | 6 | |
| 7 | -class AddConfigTable20210708043103 extends AbstractMigration |
|
| 8 | -{ |
|
| 7 | +class AddConfigTable20210708043103 extends AbstractMigration { |
|
| 9 | 8 | |
| 10 | 9 | public function up(): void |
| 11 | 10 | { |