forked from mikelbring/tinyissue
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement setting to select default tag for new issue
Fixes #85
- Loading branch information
Showing
5 changed files
with
91 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
database/migrations/2016_05_10_222358_add_settings_first_status_tag.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Tinyissue\Model\Setting; | ||
|
||
class AddSettingsFirstStatusTag extends Migration | ||
{ | ||
/** | ||
* List of settings to insert. | ||
* | ||
* @var array | ||
*/ | ||
protected $data = [ | ||
'first_status_tag' => [ | ||
'name' => 'first_status_tag', | ||
'value' => 0, | ||
], | ||
]; | ||
|
||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
foreach ($this->data as $key => $row) { | ||
$settings = new Setting(); | ||
$settings->fill([ | ||
'name' => $row['name'], | ||
'value' => $row['value'], | ||
'key' => $key, | ||
])->save(); | ||
unset($settings); | ||
} | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
foreach ($this->data as $key => $row) { | ||
$settings = new Setting(); | ||
$setting = $settings->where('key', '=', $key)->first(); | ||
if ($setting) { | ||
$setting->delete(); | ||
} | ||
unset($settings); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters