Merge branch 'develop'

This commit is contained in:
2022-03-07 12:07:51 -03:00
28 changed files with 342 additions and 209 deletions

2
.adminer.env.sample Normal file
View File

@ -0,0 +1,2 @@
ADMINER_DESIGN=dracula
ADMINER_PLUGINS=dump-json

4
.db.env.sample Normal file
View File

@ -0,0 +1,4 @@
MYSQL_DATABASE=
MYSQL_PASSWORD=
MYSQL_ROOT_PASSWORD=
MYSQL_USER=

2
.env.sample Normal file
View File

@ -0,0 +1,2 @@
BASE_URL=
MYSQL_HOST=

19
.gitignore vendored
View File

@ -1,9 +1,10 @@
.env
/vendor/
composer.lock
/node_modules/
package-lock.json
Pipfile.lock
/logs/
/cache/
/modules/
**/*.env
**/vendor/
**/composer.lock
**/node_modules/
**/package-lock.json
**/Pipfile.lock
**/logs/
**/cache/
**/modules/
**/.idea/

View File

@ -1,6 +1,12 @@
FROM php:7.4-fpm
RUN docker-php-ext-install pdo pdo_mysql
RUN apt-get update && apt-get install -y libzip-dev libicu-dev git
RUN docker-php-ext-install pdo pdo_mysql zip intl
RUN pecl install xdebug-3.0.3 \
&& docker-php-ext-enable xdebug
COPY --from=composer /usr/bin/composer /usr/bin/composer
WORKDIR /code

View File

@ -3,8 +3,8 @@
"description" : "Asset manager module for my apps",
"type" : "library",
"require" : {
"aldarien/config" : "dev-master",
"aldarien/contract" : "dev-master"
"aldarien/config" : "*",
"aldarien/contract" : "*"
},
"require-dev" : {
"phpunit/phpunit" : "^6.3"

View File

@ -10,8 +10,8 @@
}
],
"require": {
"aldarien/contract": "dev-master",
"aldarien/root": "dev-master",
"aldarien/contract": "*",
"aldarien/root": "*",
"symfony/yaml": "^3.3"
},
"autoload": {

View File

@ -4,7 +4,7 @@
"type" : "library",
"require-dev" : {
"phpunit/phpunit" : "^6",
"aldarien/config": "dev-master"
"aldarien/config": "*"
},
"license" : "MIT",
"authors" : [{

View File

@ -4,7 +4,7 @@
"type" : "library",
"require" : {
"wixel/gump" : "^1.5",
"aldarien/contract" : "dev-master"
"aldarien/contract" : "*"
},
"require-dev" : {
"phpunit/phpunit" : "^6.3"

View File

@ -4,7 +4,7 @@
"type": "library",
"require": {
"aura/session": "^2.1",
"aldarien/contract": "dev-master"
"aldarien/contract": "*"
},
"require-dev": {
"phpunit/phpunit": "^6.3"

View File

@ -3,8 +3,8 @@
"description" : "Get relative path uri",
"type" : "library",
"require" : {
"aldarien/contract" : "dev-master",
"aldarien/root" : "dev-master",
"aldarien/contract" : "*",
"aldarien/root" : "*",
"league/uri": "^5.2",
"sabre/uri": "^2.1"
},

View File

@ -4,8 +4,8 @@
"type": "library",
"require": {
"philo/laravel-blade": "^3.1",
"aldarien/contract": "dev-master",
"aldarien/config": "dev-master"
"aldarien/contract": "*",
"aldarien/config": "*"
},
"license": "MIT",
"authors": [

View File

@ -1,6 +1,7 @@
<?php
include_once dirname(__DIR__) . '/vendor/autoload.php';
include_once 'errors.php';
include_once 'dotenv.php';
include_once 'database.php';
include_once 'routes.php';
?>

12
bootstrap/dotenv.php Normal file
View File

@ -0,0 +1,12 @@
<?php
use Dotenv\Dotenv;
$folder = dirname(__DIR__);
$files = new DirectoryIterator($folder);
foreach ($files as $file) {
if ($file->isDir() or $file->getExtension() != 'env') {
continue;
}
$env = Dotenv::createImmutable($file->getPath(), $file->getBasename());
$env->load();
}

View File

@ -3,26 +3,27 @@
"description" : "Intranet portal for Incoviba",
"type" : "project",
"require" : {
"aldarien/config" : "dev-master",
"aldarien/asset" : "dev-master",
"aldarien/format" : "dev-master",
"aldarien/response" : "dev-master",
"aldarien/view" : "dev-master",
"aldarien/session" : "dev-master",
"aldarien/config" : "*",
"aldarien/asset" : "*",
"aldarien/format" : "*",
"aldarien/response" : "*",
"aldarien/view" : "*",
"aldarien/session" : "*",
"aldarien/url": "*",
"j4mie/paris" : "^1.5",
"danielstjules/stringy" : "^3.1",
"phpoffice/phpspreadsheet": "1-beta",
"aldarien/url": "dev-master",
"nesbot/carbon": "^2",
"phpoffice/phpword": "^0.14.0",
"slam/php-excel": "^4.4",
"fabpot/goutte": "^3.2",
"incoviba/modelos": "dev-master",
"incoviba/modelos": "*",
"slim/slim": "4.x-dev",
"php-di/slim-bridge": "dev-master",
"rubellum/slim-blade-view": "dev-master",
"nyholm/psr7": "1.4.x-dev",
"nyholm/psr7-server": "dev-master"
"nyholm/psr7-server": "dev-master",
"vlucas/phpdotenv": "^5.3"
},
"require-dev" : {
"phpunit/phpunit" : "^6.3",
@ -56,10 +57,7 @@
},
{
"type": "path",
"url": "./incoviba/modelos",
"options": {
"symlink": false
}
"url": "./incoviba/modelos"
}
]
}

View File

@ -1,11 +1,13 @@
<?php
include_once dirname(__DIR__) . '/bootstrap/dotenv.php';
return [
'mysql' => [
'host' => 'localhost',
'host' => $_ENV['MYSQL_HOST'],
//'port' => 3306,
'database' => 'incoviba',
'username' => 'incoviba',
'password' => '5GQYFvRjVw2A4KcD'
'database' => $_ENV['MYSQL_DATABASE'],
'username' => $_ENV['MYSQL_USER'],
'password' => $_ENV['MYSQL_PASSWORD']
],
'mysql_copy' => [
'host' => 'localhost',

View File

@ -13,8 +13,6 @@ services:
php:
build: .
container_name: php
ports:
- 9123:9000
volumes:
- .:/code
@ -22,8 +20,6 @@ services:
container_name: db
image: mariadb:latest
restart: unless-stopped
ports:
- 3308:3306
env_file: .db.env
volumes:
- dbdata:/var/lib/mysql

View File

@ -20,5 +20,10 @@ class Escritura extends Model
{
return $this->belongs_to(Pago::class, 'pago')->findOne();
}
public function valor(string $tipo = 'pesos')
{
return $this->pago()->valor($tipo);
}
}
?>

Submodule modules/operadores updated: 71e10c52bd...4f7241e146

View File

@ -5,32 +5,32 @@ use DI\Bridge\Slim\Bridge;
include_once 'composer.php';
$folders = [
'env',
'common',
$__environment
];
$files = [
'config',
'settings',
'setups'
];
$builder = new Builder();
foreach ($files as $file) {
foreach ($folders as $folder) {
$filename = implode(DIRECTORY_SEPARATOR, [
foreach ($folders as $f) {
$folder = implode(DIRECTORY_SEPARATOR, [
__DIR__,
$folder,
$file . '.php'
$f
]);
if (!file_exists($filename)) {
if (!file_exists($folder)) {
continue;
}
$builder->addDefinitions($filename);
$files = new DirectoryIterator($folder);
foreach ($files as $file) {
if ($file->isDir() or $file->getExtension() != 'php') {
continue;
}
$builder->addDefinitions($file->getRealPath());
}
}
$container = $builder->build();
$app = Bridge::create($container);
$app->setBasePath($app->getContainer()->get('base_url'));
if ($app->getContainer()->has('base_url') and $app->getContainer()->get('base_url') != '') {
$app->setBasePath($app->getContainer()->get('base_url'));
}
$app->addRoutingMiddleware();
foreach ($folders as $folder) {

View File

@ -10,11 +10,11 @@ return [
'databases' => function() {
$arr = [
'mysql' => [
'host' => 'localhost',
'host' => $_ENV['MYSQL_HOST'],
//'port' => 3306,
'database' => 'incoviba',
'username' => 'incoviba',
'password' => '5GQYFvRjVw2A4KcD'
'database' => $_ENV['MYSQL_DATABASE'],
'username' => $_ENV['MYSQL_USER'],
'password' => $_ENV['MYSQL_PASSWORD']
],
'mysql_copy' => [
'host' => 'localhost',

16
setup/env/config.php vendored
View File

@ -1,6 +1,18 @@
<?php
use Dotenv\Dotenv;
$folder = dirname(__DIR__, 2);
$files = new DirectoryIterator($folder);
foreach ($files as $file) {
if ($file->isDir() or $file->getExtension() != 'env') {
continue;
}
$env = Dotenv::createImmutable($file->getPath(), $file->getBasename());
$env->load();
}
return [
'debug' => false,
'debug' => $_ENV['DEBUG'] ?? false,
'benchmark' => false,
'base_url' => '/incoviba'
'base_url' => $_ENV['BASE_URL']//'/incoviba'
];

18
setup/settings/01_env.php Normal file
View File

@ -0,0 +1,18 @@
<?php
use Dotenv\Dotenv;
$folder = dirname(__DIR__, 2);
$files = new DirectoryIterator($folder);
foreach ($files as $file) {
if ($file->isDir() or $file->getExtension() != 'env') {
continue;
}
$env = Dotenv::createImmutable($file->getPath(), $file->getBasename());
$env->load();
}
return [
'debug' => $_ENV['DEBUG'] ?? false,
'benchmark' => false,
'base_url' => $_ENV['BASE_URL'] ?? '/incoviba'
];

View File

@ -0,0 +1,40 @@
<?php
return [
'timezone' => 'America/Santiago',
'locale' => 'es',
'database' => 'mysql',
'login_hours' => 5*24,
'cierres' => [
'caducidad' => 30
],
'databases' => function() {
$arr = [
'mysql' => [
'host' => $_ENV['MYSQL_HOST'],
//'port' => 3306,
'database' => $_ENV['MYSQL_DATABASE'],
'username' => $_ENV['MYSQL_USER'],
'password' => $_ENV['MYSQL_PASSWORD']
],
'mysql_copy' => [
'host' => 'localhost',
'database' => 'incoviba3',
'username' => 'incoviba',
'password' => '5GQYFvRjVw2A4KcD'
]
];
return $arr;
},
'locations' => function() {
$arr = ['base' => dirname(__DIR__, 2)];
$arr['public'] = $arr['base'] . '/public';
$arr['resources'] = $arr['base'] . '/resources';
$arr['routes'] = $arr['resources'] . '/routes';
$arr['src'] = $arr['base'] . '/src';
$arr['app'] = $arr['base'] . '/app';
$arr['controllers'] = $arr['app'] . '/Controller';
$arr['money'] = 'http://provm.cl/optimus/money';
$arr['api'] = 'http://localhost:8080/api';
return (object) $arr;
}
];

View File

@ -0,0 +1,8 @@
<?php
use Psr\Container\ContainerInterface as Container;
return [
'base_url' => DI\decorate(function($prev, Container $c) {
return $prev . '/api';
})
];

11
setup/settings/04_ui.php Normal file
View File

@ -0,0 +1,11 @@
<?php
use Psr\Container\ContainerInterface as Container;
return [
'locations' => DI\decorate(function($prev, Container $c) {
$arr = (array) $prev;
$arr['cache'] = $prev->base . '/cache';
$arr['views'] = $prev->resources . '/views';
return (object) $arr;
})
];

15
setup/setups/04_ui.php Normal file
View File

@ -0,0 +1,15 @@
<?php
use Psr\Container\ContainerInterface as Container;
return [
Slim\Views\Blade::class => function(Container $c) {
return new Slim\Views\Blade(
$c->get('locations')->views,
$c->get('locations')->cache,
null,
[
'locations' => $c->get('locations')
]
);
}
];