include vagrant and update README
This commit is contained in:
@@ -18,12 +18,12 @@ install: db
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
reset:
|
reset:
|
||||||
@rm database/testing.sqlite
|
-@rm database/testing.sqlite
|
||||||
@php artisan optimize
|
@php artisan optimize
|
||||||
@php artisan route:clear
|
@php artisan route:clear
|
||||||
@php artisan config:clear
|
@php artisan config:clear
|
||||||
@sqlite3 database/testing.sqlite ""
|
@sqlite3 database/testing.sqlite ""
|
||||||
@php artisan migrate:refresh --seed
|
@php artisan migrate:refresh --seed --seeder DevelopmentSeeder
|
||||||
|
|
||||||
db:
|
db:
|
||||||
sqlite3 database/testing.sqlite ""
|
sqlite3 database/testing.sqlite ""
|
||||||
|
|||||||
@@ -36,11 +36,49 @@ server {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## using laradock
|
## development environment
|
||||||
|
|
||||||
[laradock](http://laradock.io/) is probably the simplest way to get an env working, and is what I use. just follow the instructions and point `APPLICATION=../phpvms` to your phpvms path.
|
For development, copy the included `.env.example` to `.env` file. By default, it uses sqlite
|
||||||
|
instead of mysql. This makes it much easier to be able to clear the database and new fixtures.
|
||||||
|
|
||||||
see [this article](https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-an-nginx-web-server-on-ubuntu-14-04) for more detailed instructions.
|
### makefile commands
|
||||||
|
|
||||||
|
I use Makefiles to be able to quickly setup the environment.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# to do an initial setup of the composer deps and install the DB
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
Then to reset the database/clear cache, use:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make reset
|
||||||
|
```
|
||||||
|
|
||||||
|
### database seeding
|
||||||
|
|
||||||
|
There is a `database/seeds/dev.yml` which contains the initial seed data that can be used
|
||||||
|
for testing. For production use, there is a `prod.yml` file. The `make reset` handles seeding
|
||||||
|
the database with the data from the `dev.yml`.
|
||||||
|
|
||||||
|
### virtual machine
|
||||||
|
|
||||||
|
Using [Laravel Homestead](https://laravel.com/docs/5.4/homestead) is probably the easiest
|
||||||
|
way to get this working. Follow their instructions for install. A `Vagrantfile` and `Homestead.yaml`
|
||||||
|
is included here. Add this to your `/etc/hosts`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
127.0.0.1 phpvms.app
|
||||||
|
```
|
||||||
|
|
||||||
|
And then to launch:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
vagrant up
|
||||||
|
```
|
||||||
|
|
||||||
|
And then accessing it via `http://phpvms.app` should just work.
|
||||||
|
|
||||||
(TODO: redis information, etc)
|
(TODO: redis information, etc)
|
||||||
|
|
||||||
|
|||||||
Vendored
+44
@@ -0,0 +1,44 @@
|
|||||||
|
# -*- mode: ruby -*-
|
||||||
|
# vi: set ft=ruby :
|
||||||
|
|
||||||
|
require 'json'
|
||||||
|
require 'yaml'
|
||||||
|
|
||||||
|
VAGRANTFILE_API_VERSION ||= "2"
|
||||||
|
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__))
|
||||||
|
|
||||||
|
homesteadYamlPath = File.expand_path("Homestead.yaml", File.dirname(__FILE__))
|
||||||
|
homesteadJsonPath = File.expand_path("Homestead.json", File.dirname(__FILE__))
|
||||||
|
afterScriptPath = "after.sh"
|
||||||
|
aliasesPath = "aliases"
|
||||||
|
|
||||||
|
require File.expand_path(confDir + '/scripts/homestead.rb')
|
||||||
|
|
||||||
|
Vagrant.require_version '>= 1.9.0'
|
||||||
|
|
||||||
|
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
|
if File.exist? aliasesPath then
|
||||||
|
config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
|
||||||
|
config.vm.provision "shell" do |s|
|
||||||
|
s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if File.exist? homesteadYamlPath then
|
||||||
|
settings = YAML::load(File.read(homesteadYamlPath))
|
||||||
|
elsif File.exist? homesteadJsonPath then
|
||||||
|
settings = JSON.parse(File.read(homesteadJsonPath))
|
||||||
|
else
|
||||||
|
abort "Homestead settings file not found in #{confDir}"
|
||||||
|
end
|
||||||
|
|
||||||
|
Homestead.configure(config, settings)
|
||||||
|
|
||||||
|
if File.exist? afterScriptPath then
|
||||||
|
config.vm.provision "shell", path: afterScriptPath, privileged: false
|
||||||
|
end
|
||||||
|
|
||||||
|
if defined? VagrantPlugins::HostsUpdater
|
||||||
|
config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# If you would like to do some extra provisioning you may
|
||||||
|
# add any commands you wish to this file and they will
|
||||||
|
# be run after the Homestead machine is provisioned.
|
||||||
@@ -0,0 +1,208 @@
|
|||||||
|
alias ..="cd .."
|
||||||
|
alias ...="cd ../.."
|
||||||
|
|
||||||
|
alias h='cd ~'
|
||||||
|
alias c='clear'
|
||||||
|
alias art=artisan
|
||||||
|
|
||||||
|
alias phpspec='vendor/bin/phpspec'
|
||||||
|
alias phpunit='vendor/bin/phpunit'
|
||||||
|
alias serve=serve-laravel
|
||||||
|
|
||||||
|
alias xoff='sudo phpdismod -s cli xdebug'
|
||||||
|
alias xon='sudo phpenmod -s cli xdebug'
|
||||||
|
|
||||||
|
function artisan() {
|
||||||
|
php artisan "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function dusk() {
|
||||||
|
pids=$(pidof /usr/bin/Xvfb)
|
||||||
|
|
||||||
|
if [ ! -n "$pids" ]; then
|
||||||
|
Xvfb :0 -screen 0 1280x960x24 &
|
||||||
|
fi
|
||||||
|
|
||||||
|
php artisan dusk "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function serve-apache() {
|
||||||
|
if [[ "$1" && "$2" ]]
|
||||||
|
then
|
||||||
|
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||||
|
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/serve-apache.sh
|
||||||
|
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-apache.sh "$1" "$2" 80
|
||||||
|
else
|
||||||
|
echo "Error: missing required parameters."
|
||||||
|
echo "Usage: "
|
||||||
|
echo " serve-apache domain path"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function serve-laravel() {
|
||||||
|
if [[ "$1" && "$2" ]]
|
||||||
|
then
|
||||||
|
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||||
|
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/serve-laravel.sh
|
||||||
|
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-laravel.sh "$1" "$2" 80
|
||||||
|
else
|
||||||
|
echo "Error: missing required parameters."
|
||||||
|
echo "Usage: "
|
||||||
|
echo " serve domain path"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function serve-proxy() {
|
||||||
|
if [[ "$1" && "$2" ]]
|
||||||
|
then
|
||||||
|
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/serve-proxy.sh
|
||||||
|
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-proxy.sh "$1" "$2" 80
|
||||||
|
else
|
||||||
|
echo "Error: missing required parameters."
|
||||||
|
echo "Usage: "
|
||||||
|
echo " serve-proxy domain port"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function serve-silverstripe() {
|
||||||
|
if [[ "$1" && "$2" ]]
|
||||||
|
then
|
||||||
|
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||||
|
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/serve-silverstripe.sh
|
||||||
|
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-silverstripe.sh "$1" "$2" 80
|
||||||
|
else
|
||||||
|
echo "Error: missing required parameters."
|
||||||
|
echo "Usage: "
|
||||||
|
echo " serve-silverstripe domain path"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function serve-spa() {
|
||||||
|
if [[ "$1" && "$2" ]]
|
||||||
|
then
|
||||||
|
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||||
|
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/serve-spa.sh
|
||||||
|
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-spa.sh "$1" "$2" 80
|
||||||
|
else
|
||||||
|
echo "Error: missing required parameters."
|
||||||
|
echo "Usage: "
|
||||||
|
echo " serve-spa domain path"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function serve-statamic() {
|
||||||
|
if [[ "$1" && "$2" ]]
|
||||||
|
then
|
||||||
|
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||||
|
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/serve-statamic.sh
|
||||||
|
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-statamic.sh "$1" "$2" 80
|
||||||
|
else
|
||||||
|
echo "Error: missing required parameters."
|
||||||
|
echo "Usage: "
|
||||||
|
echo " serve-statamic domain path"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function serve-symfony2() {
|
||||||
|
if [[ "$1" && "$2" ]]
|
||||||
|
then
|
||||||
|
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||||
|
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/serve-symfony2.sh
|
||||||
|
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-symfony2.sh "$1" "$2" 80
|
||||||
|
else
|
||||||
|
echo "Error: missing required parameters."
|
||||||
|
echo "Usage: "
|
||||||
|
echo " serve-symfony2 domain path"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function share() {
|
||||||
|
if [[ "$1" ]]
|
||||||
|
then
|
||||||
|
ngrok http ${@:2} -host-header="$1" 80
|
||||||
|
else
|
||||||
|
echo "Error: missing required parameters."
|
||||||
|
echo "Usage: "
|
||||||
|
echo " share domain"
|
||||||
|
echo "Invocation with extra params passed directly to ngrok"
|
||||||
|
echo " share domain -region=eu -subdomain=test1234"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function flip() {
|
||||||
|
sudo bash /vagrant/vendor/laravel/homestead/scripts/flip-webserver.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
function __has_pv() {
|
||||||
|
$(hash pv 2>/dev/null);
|
||||||
|
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
function __pv_install_message() {
|
||||||
|
if ! __has_pv; then
|
||||||
|
echo $1
|
||||||
|
echo "Install pv with \`sudo apt-get install -y pv\` then run this command again."
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function dbexport() {
|
||||||
|
FILE=${1:-/vagrant/mysqldump.sql.gz}
|
||||||
|
|
||||||
|
# This gives an estimate of the size of the SQL file
|
||||||
|
# It appears that 80% is a good approximation of
|
||||||
|
# the ratio of estimated size to actual size
|
||||||
|
SIZE_QUERY="select ceil(sum(data_length) * 0.8) as size from information_schema.TABLES"
|
||||||
|
|
||||||
|
__pv_install_message "Want to see export progress?"
|
||||||
|
|
||||||
|
echo "Exporting databases to '$FILE'"
|
||||||
|
|
||||||
|
if __has_pv; then
|
||||||
|
ADJUSTED_SIZE=$(mysql --vertical -uhomestead -psecret -e "$SIZE_QUERY" 2>/dev/null | grep 'size' | awk '{print $2}')
|
||||||
|
HUMAN_READABLE_SIZE=$(numfmt --to=iec-i --suffix=B --format="%.3f" $ADJUSTED_SIZE)
|
||||||
|
|
||||||
|
echo "Estimated uncompressed size: $HUMAN_READABLE_SIZE"
|
||||||
|
mysqldump -uhomestead -psecret --all-databases --skip-lock-tables 2>/dev/null | pv --size=$ADJUSTED_SIZE | gzip > "$FILE"
|
||||||
|
else
|
||||||
|
mysqldump -uhomestead -psecret --all-databases --skip-lock-tables 2>/dev/null | gzip > "$FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Done."
|
||||||
|
}
|
||||||
|
|
||||||
|
function dbimport() {
|
||||||
|
FILE=${1:-/vagrant/mysqldump.sql.gz}
|
||||||
|
|
||||||
|
__pv_install_message "Want to see import progress?"
|
||||||
|
|
||||||
|
echo "Importing databases from '$FILE'"
|
||||||
|
|
||||||
|
if __has_pv; then
|
||||||
|
pv "$FILE" --progress --eta | zcat | mysql -uhomestead -psecret 2>/dev/null
|
||||||
|
else
|
||||||
|
cat "$FILE" | zcat | mysql -uhomestead -psecret 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Done."
|
||||||
|
}
|
||||||
|
|
||||||
|
function xphp() {
|
||||||
|
(php -m | grep -q xdebug)
|
||||||
|
if [[ $? -eq 0 ]]
|
||||||
|
then
|
||||||
|
XDEBUG_ENABLED=true
|
||||||
|
else
|
||||||
|
XDEBUG_ENABLED=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! $XDEBUG_ENABLED; then xon; fi
|
||||||
|
|
||||||
|
php \
|
||||||
|
-dxdebug.remote_host=192.168.10.1 \
|
||||||
|
-dxdebug.remote_autostart=1 \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
if ! $XDEBUG_ENABLED; then xoff; fi
|
||||||
|
}
|
||||||
+6
-2
@@ -25,7 +25,8 @@
|
|||||||
"mockery/mockery": "0.9.*",
|
"mockery/mockery": "0.9.*",
|
||||||
"phpunit/phpunit": "~5.7",
|
"phpunit/phpunit": "~5.7",
|
||||||
"symfony/css-selector": "3.1.*",
|
"symfony/css-selector": "3.1.*",
|
||||||
"symfony/dom-crawler": "3.1.*"
|
"symfony/dom-crawler": "3.1.*",
|
||||||
|
"laravel/homestead": "^5.4"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"classmap": [
|
"classmap": [
|
||||||
@@ -60,6 +61,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"preferred-install": "dist"
|
"preferred-install": "dist",
|
||||||
|
"bin-dir": "vendor/bin/",
|
||||||
|
"secure-http": false,
|
||||||
|
"disable-tls": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+56
-6
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "74036cb1d4ba5a8114ee893fc869e92d",
|
"content-hash": "2a812ab5f98781a23f47744c8a1f4fdd",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "barryvdh/laravel-ide-helper",
|
"name": "barryvdh/laravel-ide-helper",
|
||||||
@@ -737,7 +737,7 @@
|
|||||||
"laravel",
|
"laravel",
|
||||||
"templates"
|
"templates"
|
||||||
],
|
],
|
||||||
"time": "2017-05-20T10:43:37+00:00"
|
"time": "2017-05-20 10:43:37"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "infyomlabs/laravel-generator",
|
"name": "infyomlabs/laravel-generator",
|
||||||
@@ -792,7 +792,7 @@
|
|||||||
"test",
|
"test",
|
||||||
"view"
|
"view"
|
||||||
],
|
],
|
||||||
"time": "2016-08-18T14:19:50+00:00"
|
"time": "2016-08-18 14:19:50"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "infyomlabs/swagger-generator",
|
"name": "infyomlabs/swagger-generator",
|
||||||
@@ -829,7 +829,7 @@
|
|||||||
"swagger",
|
"swagger",
|
||||||
"templates"
|
"templates"
|
||||||
],
|
],
|
||||||
"time": "2016-02-14T10:41:03+00:00"
|
"time": "2016-02-14 10:41:03"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "jeremeamia/SuperClosure",
|
"name": "jeremeamia/SuperClosure",
|
||||||
@@ -932,7 +932,7 @@
|
|||||||
"laravel",
|
"laravel",
|
||||||
"swagger"
|
"swagger"
|
||||||
],
|
],
|
||||||
"time": "2016-01-25T15:38:17+00:00"
|
"time": "2016-01-25 15:38:17"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laracasts/flash",
|
"name": "laracasts/flash",
|
||||||
@@ -3417,7 +3417,7 @@
|
|||||||
"permission",
|
"permission",
|
||||||
"roles"
|
"roles"
|
||||||
],
|
],
|
||||||
"time": "2016-12-29T06:25:06+00:00"
|
"time": "2016-12-29 06:25:06"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [
|
"packages-dev": [
|
||||||
@@ -3568,6 +3568,56 @@
|
|||||||
],
|
],
|
||||||
"time": "2015-05-11T14:41:42+00:00"
|
"time": "2015-05-11T14:41:42+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "laravel/homestead",
|
||||||
|
"version": "v5.4.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/laravel/homestead.git",
|
||||||
|
"reference": "f54a9f0b6a0de85c96d5e82fd94a563d979f8288"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/laravel/homestead/zipball/f54a9f0b6a0de85c96d5e82fd94a563d979f8288",
|
||||||
|
"reference": "f54a9f0b6a0de85c96d5e82fd94a563d979f8288",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^5.6 || ^7.0",
|
||||||
|
"symfony/console": "~2.3|~3.0",
|
||||||
|
"symfony/process": "~2.3|~3.0",
|
||||||
|
"symfony/yaml": "~2.3|~3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^5.7 || ^6.0"
|
||||||
|
},
|
||||||
|
"bin": [
|
||||||
|
"bin/homestead"
|
||||||
|
],
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "4.0-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Laravel\\Homestead\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Taylor Otwell",
|
||||||
|
"email": "taylorotwell@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A virtual machine for web artisans.",
|
||||||
|
"time": "2017-06-09T13:53:37+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "mockery/mockery",
|
"name": "mockery/mockery",
|
||||||
"version": "0.9.9",
|
"version": "0.9.9",
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class DevelopmentSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$this->seed_from_yaml();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function time(): string
|
||||||
|
{
|
||||||
|
return Carbon::now('UTC')->format('Y-m-d H:i:s');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function seed_from_yaml(): void
|
||||||
|
{
|
||||||
|
$time_fields = ['created_at', 'updated_at'];
|
||||||
|
|
||||||
|
$yml = Yaml::parse(file_get_contents(database_path('seeds/dev.yml')));
|
||||||
|
foreach ($yml as $table => $rows) {
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
|
||||||
|
# encrypt any password fields
|
||||||
|
if(in_array('password', $row, true)) {
|
||||||
|
$row['password'] = bcrypt($row['password']);
|
||||||
|
}
|
||||||
|
|
||||||
|
# if any time fields are == to "now", then insert the right time
|
||||||
|
foreach($time_fields as $tf) {
|
||||||
|
if(in_array($tf, $row, true) && $row[$tf] === 'now') {
|
||||||
|
$row[$tf] = $this->time();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::table($table)->insert($row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,11 +1,34 @@
|
|||||||
#
|
#
|
||||||
|
roles:
|
||||||
|
- id: 1
|
||||||
|
name: admin
|
||||||
|
display_name: Administrators
|
||||||
|
- id: 2
|
||||||
|
name: user
|
||||||
|
display_name: Pilot
|
||||||
|
|
||||||
|
users:
|
||||||
|
- id: 1
|
||||||
|
name: Admin User
|
||||||
|
email: admin@phpvms.net
|
||||||
|
password: admin
|
||||||
|
created_at: now
|
||||||
|
updated_at: now
|
||||||
|
|
||||||
|
role_user:
|
||||||
|
- user_id: 1
|
||||||
|
role_id: 1
|
||||||
|
- user_id: 1
|
||||||
|
role_id: 2
|
||||||
|
|
||||||
airlines:
|
airlines:
|
||||||
- id: 1
|
- id: 1
|
||||||
code: VMS
|
code: VMS
|
||||||
name: phpvms airlines
|
name: phpvms airlines
|
||||||
active: 1
|
active: 1
|
||||||
|
created_at: now
|
||||||
|
updated_at: now
|
||||||
|
|
||||||
#
|
|
||||||
airports:
|
airports:
|
||||||
- icao: KAUS
|
- icao: KAUS
|
||||||
name: Austin-Bergstrom International Airport
|
name: Austin-Bergstrom International Airport
|
||||||
Reference in New Issue
Block a user