This commit is contained in:
Your Name 2021-08-04 16:11:37 +02:00
commit 9db5f1b5e3
16 changed files with 249 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

12
.hooks/pre-commit Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
FILES=$(git diff --cached --name-only --diff-filter=ACMR -- '*.php' '*.html' '*.yaml' | sed 's| |\\ |g')
[ -z "$FILES" ] && exit 0
# Prettify all selected files
echo "$FILES" | xargs ./node_modules/.bin/prettier --ignore-unknown --write
# Add back the modified/prettified files to staging
echo "$FILES" | xargs git add
exit 0

1
.prettierignore Normal file
View File

@ -0,0 +1 @@
vendor

11
.prettierrc Normal file
View File

@ -0,0 +1,11 @@
{
"printWidth": 120,
"tabWidth": 2,
"singleQuote": true,
"semi": true,
"trailingComma": "es5",
"arrowParens": "always",
"phpVersion": "7.1"
}

17
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,17 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[php]":
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
"search.exclude": {
"**/vendor": true,
"**/node_modules": true,
"yarn.lock": true,
"package.json": true,
"tsconfig.json": true,
".*": true,
},
}

20
Plugin.php Normal file
View File

@ -0,0 +1,20 @@
<?php namespace GermanAirlinesVa\Routes;
use Config;
use System\Classes\PluginBase;
class Plugin extends PluginBase
{
public function registerComponents()
{
}
public function registerSettings()
{
}
public function boot()
{
Config::set('database.connections.germanairlinesva_routes', Config::get('germanairlinesva.routes::connection'));
}
}

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# Relations

9
composer.json Normal file
View File

@ -0,0 +1,9 @@
{
"name": "germanairlinesva/routes",
"type": "october-plugin",
"description": "None",
"require": {
"composer/installers": "~1.0"
}
}

25
config/config.php Normal file
View File

@ -0,0 +1,25 @@
<?php
return [
'connection' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => 'germanairlinesva_routes',
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => 'InnoDB',
'options' => extension_loaded('pdo_mysql')
? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
])
: [],
],
];

9
lang/en/lang.php Normal file
View File

@ -0,0 +1,9 @@
<?php return [
'plugin' => [
'name' => 'GA Routes',
'description' => '',
],
'menu' => [
'routes' => 'GA Routes',
],
];

16
package.json Normal file
View File

@ -0,0 +1,16 @@
{
"name": "routes",
"version": "1.0.0",
"main": "Plugin.php",
"repository": "https://git.hofmannnet.myhome-server.de/GermanAirlines/GermanAirlinesVA-Routes.git",
"author": "German Airlines VA",
"license": "MIT",
"devDependencies": {
"@prettier/plugin-php": "^0.17.3",
"prettier": "^2.3.0"
},
"scripts": {
"preinstall": "git config core.hooksPath .hooks",
"format": "prettier --write './**/*.{php,html,yaml}'"
}
}

11
plugin.yaml Normal file
View File

@ -0,0 +1,11 @@
plugin:
name: 'germanairlinesva.routes::lang.plugin.name'
description: 'germanairlinesva.routes::lang.plugin.description'
author: 'German Airlines VA'
icon: oc-icon-location-arrow
homepage: ''
navigation:
main-menu-item:
label: 'germanairlinesva.routes::lang.menu.routes'
url: /
icon: icon-location-arrow

View File

@ -0,0 +1,27 @@
<?php namespace GermanAirlinesVa\Routes\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableCreateAirports extends Migration
{
public function up()
{
Schema::connection('germanairlinesva_routes')->create('airports', function ($table) {
$table->engine = 'InnoDB';
$table->bigIncrements('id')->unsigned();
$table->string('iata', 3);
$table->string('icao', 3);
$table->string('name');
$table->string('country');
$table->string('elevation');
$table->string('latitude');
$table->string('longitude');
});
}
public function down()
{
Schema::connection('germanairlinesva_routes')->dropIfExists('airports');
}
}

View File

@ -0,0 +1,30 @@
<?php namespace GermanAirlinesVa\Routes\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableCreateGermanAirlinesVaRoutesDeferredBindings extends Migration
{
public function up()
{
Schema::connection('germanairlinesva_routes')->create('deferred_bindings', function ($table) {
$table->engine = 'InnoDB';
$table->increments('id')->unsigned();
$table->string('master_type');
$table->string('master_field');
$table->string('slave_type');
$table->integer('slave_id');
$table->mediumText('pivot_data')->nullable();
$table->string('session_key');
$table->boolean('is_bind')->default(true);
$table->timestamps();
});
}
public function down()
{
Schema::connection('germanairlinesva_routes')->disableForeignKeyConstraints();
Schema::connection('germanairlinesva_routes')->dropIfExists('deferred_bindings');
Schema::connection('germanairlinesva_routes')->enableForeignKeyConstraints();
}
}

7
updates/version.yaml Normal file
View File

@ -0,0 +1,7 @@
1.0.1:
- 'Initialize plugin.'
- 'Create table deferred_bindings'
- builder_table_create_deferred_bindings.php
1.0.2:
- 'Create table airports'
- builder_table_create_airports.php

51
yarn.lock Normal file
View File

@ -0,0 +1,51 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@prettier/plugin-php@^0.17.3":
version "0.17.3"
resolved "https://registry.yarnpkg.com/@prettier/plugin-php/-/plugin-php-0.17.3.tgz#193a18e308db7416f26f6e1dc0d2605d1ff01416"
integrity sha512-kD5IrGyKWF/p3XActVZ+GfbMl9knoK3XKBTG2bytpOtCO0+Q8eozimSgk/493rgFkXL3W2Ap/4GKgZf7u64+ow==
dependencies:
linguist-languages "^7.5.1"
mem "^8.0.0"
php-parser "https://github.com/glayzzle/php-parser#e61e26102144f267ecf5e09020865a9baa6ca2f1"
linguist-languages@^7.5.1:
version "7.15.0"
resolved "https://registry.yarnpkg.com/linguist-languages/-/linguist-languages-7.15.0.tgz#a93bed6b93015d8133622cb05da6296890862bfa"
integrity sha512-qkSSNDjDDycZ2Wcw+GziNBB3nNo3ddYUInM/PL8Amgwbd9RQ/BKGj2/1d6mdxKgBFnUqZuaDbkIwkE4KUwwmtQ==
map-age-cleaner@^0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a"
integrity sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==
dependencies:
p-defer "^1.0.0"
mem@^8.0.0:
version "8.1.1"
resolved "https://registry.yarnpkg.com/mem/-/mem-8.1.1.tgz#cf118b357c65ab7b7e0817bdf00c8062297c0122"
integrity sha512-qFCFUDs7U3b8mBDPyz5EToEKoAkgCzqquIgi9nkkR9bixxOVOre+09lbuH7+9Kn2NFpm56M3GUWVbU2hQgdACA==
dependencies:
map-age-cleaner "^0.1.3"
mimic-fn "^3.1.0"
mimic-fn@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-3.1.0.tgz#65755145bbf3e36954b949c16450427451d5ca74"
integrity sha512-Ysbi9uYW9hFyfrThdDEQuykN4Ey6BuwPD2kpI5ES/nFTDn/98yxYNLZJcgUAKPT/mcrLLKaGzJR9YVxJrIdASQ==
p-defer@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c"
integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=
"php-parser@git+https://github.com/glayzzle/php-parser.git#e61e26102144f267ecf5e09020865a9baa6ca2f1":
version "3.0.2"
resolved "git+https://github.com/glayzzle/php-parser.git#e61e26102144f267ecf5e09020865a9baa6ca2f1"
prettier@^2.3.0:
version "2.3.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d"
integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==