Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Learning and Work
managing-money-api
Commits
a3046ab6
Commit
a3046ab6
authored
Jul 13, 2018
by
Jack Stupple
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disable currencies unsupported at the moment and only emily and jake
parent
a48b3ef5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
98 deletions
+69
-98
database/migrations/2018_04_18_00000_initial.php
database/migrations/2018_04_18_00000_initial.php
+68
-34
database/migrations/2018_04_18_00001_create_currencies_table.php
...e/migrations/2018_04_18_00001_create_currencies_table.php
+0
-8
database/migrations/2018_04_18_00002_add_new_supported_languages.php
...grations/2018_04_18_00002_add_new_supported_languages.php
+0
-54
database/migrations/2018_04_26_000000_import_jake_questions.php
...se/migrations/2018_04_26_000000_import_jake_questions.php
+0
-1
database/migrations/2018_05_04_152619_add_social_text.php
database/migrations/2018_05_04_152619_add_social_text.php
+1
-1
No files found.
database/migrations/2018_04_18_00000_initial.php
View file @
a3046ab6
...
...
@@ -179,26 +179,7 @@ class Initial extends Migration
}
);
DB
::
table
(
'languages'
)
->
insert
([
'name'
=>
'English'
,
'slug'
=>
'en'
,
'enabled'
=>
$this
->
created_at
,
'created_at'
=>
$this
->
created_at
]);
DB
::
table
(
'languages'
)
->
insert
([
'name'
=>
'Dutch'
,
'slug'
=>
'nl'
,
'enabled'
=>
$this
->
created_at
,
'created_at'
=>
$this
->
created_at
]);
DB
::
table
(
'languages'
)
->
insert
([
'name'
=>
'German'
,
'slug'
=>
'de'
,
'enabled'
=>
$this
->
created_at
,
'created_at'
=>
$this
->
created_at
]);
$this
->
addSupportedLanguages
();
$this
->
language
=
\
App\Language
::
where
(
'slug'
,
'en'
)
->
first
();
...
...
@@ -289,14 +270,7 @@ class Initial extends Migration
}
);
$modifier_categories
=
static
::
$modifier_categories
;
foreach
(
$modifier_categories
as
&
$category
)
{
if
(
isset
(
$category
[
'icon'
]))
{
$category
[
'icon'
]
=
'/modifiers/'
.
$category
[
'icon'
];
}
}
DB
::
table
(
'modifier_categories'
)
->
insert
(
$modifier_categories
);
$this
->
addModifierCategories
();
Schema
::
create
(
'questions'
,
...
...
@@ -321,12 +295,7 @@ class Initial extends Migration
}
);
$question_categories
=
static
::
$question_categories
;
foreach
(
$question_categories
as
&
$category
)
{
$category
[
'icon'
]
=
'/question-categories/'
.
$category
[
'icon'
];
}
DB
::
table
(
'question_categories'
)
->
insert
(
$question_categories
);
$this
->
addQuestionCategories
();
Schema
::
create
(
'answers'
,
...
...
@@ -371,6 +340,71 @@ class Initial extends Migration
);
}
protected
function
addSupportedLanguages
()
{
$en
=
\
App\Language
::
firstOrCreate
([
'name'
=>
'English'
,
'slug'
=>
'en'
]);
$en
->
enabled
=
$this
->
created_at
;
$en
->
save
();
$nl
=
\
App\Language
::
firstOrCreate
([
'name'
=>
'Dutch'
,
'slug'
=>
'nl'
]);
$nl
->
enabled
=
$this
->
created_at
;
$nl
->
save
();
$de
=
\
App\Language
::
firstOrCreate
([
'name'
=>
'German'
,
'slug'
=>
'de'
]);
$de
->
enabled
=
$this
->
created_at
;
$de
->
save
();
$no
=
\
App\Language
::
firstOrCreate
([
'name'
=>
'Norwegian'
,
'slug'
=>
'no'
]);
$no
->
enabled
=
$this
->
created_at
;
$no
->
save
();
$sl
=
\
App\Language
::
firstOrCreate
([
'name'
=>
'Slovenian'
,
'slug'
=>
'sl'
]);
$sl
->
enabled
=
$this
->
created_at
;
$sl
->
save
();
}
protected
function
addQuestionCategories
()
{
$question_categories
=
static
::
$question_categories
;
foreach
(
$question_categories
as
&
$category
)
{
$category
[
'icon'
]
=
'/question-categories/'
.
$category
[
'icon'
];
}
DB
::
table
(
'question_categories'
)
->
insert
(
$question_categories
);
}
protected
function
addModifierCategories
()
{
$modifier_categories
=
static
::
$modifier_categories
;
foreach
(
$modifier_categories
as
&
$category
)
{
if
(
isset
(
$category
[
'icon'
]))
{
$category
[
'icon'
]
=
'/modifiers/'
.
$category
[
'icon'
];
}
}
DB
::
table
(
'modifier_categories'
)
->
insert
(
$modifier_categories
);
}
/**
* Reverse the migrations.
*
...
...
database/migrations/2018_04_18_00001_create_currencies_table.php
View file @
a3046ab6
...
...
@@ -24,14 +24,6 @@ class CreateCurrenciesTable extends Migration
$currency
=
new
Currency
();
$currency
->
currency_code
=
'EUR'
;
$currency
->
save
();
$currency
=
new
Currency
();
$currency
->
currency_code
=
'GBP'
;
$currency
->
save
();
$currency
=
new
Currency
();
$currency
->
currency_code
=
'NOK'
;
$currency
->
save
();
}
/**
...
...
database/migrations/2018_04_18_00002_add_new_supported_languages.php
deleted
100644 → 0
View file @
a48b3ef5
<?php
use
Illuminate\Support\Facades\Schema
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Migrations\Migration
;
class
AddNewSupportedLanguages
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
$now
=
date
(
'Y-m-d H:i:s'
);
$no
=
\
App\Language
::
firstOrCreate
([
'name'
=>
'Norwegian'
,
'slug'
=>
'no'
]);
$no
->
enabled
=
$now
;
$no
->
save
();
$sl
=
\
App\Language
::
firstOrCreate
([
'name'
=>
'Slovenian'
,
'slug'
=>
'sl'
]);
$sl
->
enabled
=
$now
;
$sl
->
save
();
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
$de
=
\
App\Language
::
where
(
'slug'
,
'de'
)
->
first
();
if
(
$de
)
{
$de
->
enabled
=
null
;
$de
->
save
();
}
$no
=
\
App\Language
::
where
(
'slug'
,
'no'
)
->
first
();
if
(
$no
)
{
$no
->
enabled
=
null
;
$no
->
save
();
}
}
}
database/migrations/2018_04_26_000000_import_jake_questions.php
View file @
a3046ab6
...
...
@@ -22,7 +22,6 @@ class ImportJakeQuestions extends CharacterMigration
*/
public
function
up
()
{
return
;
$this
->
created_at
=
date
(
'Y-m-d H:i:s'
);
$this
->
character
=
new
\
App\Character
();
...
...
database/migrations/2018_05_04_152619_add_social_text.php
View file @
a3046ab6
...
...
@@ -15,7 +15,7 @@ class AddSocialText extends Migration
*/
public
function
up
()
{
foreach
([
'emily'
,
'jake'
,
'jamal'
,
'ann'
]
as
$_character
)
{
foreach
([
'emily'
,
'jake'
]
as
$_character
)
{
$character
=
\
App\Character
::
where
(
'name'
,
'LIKE'
,
$_character
)
->
first
();
$json_path
=
APP_ROOT
.
'/resources/data/'
.
$_character
.
'/social-statuses.json'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment