Skip to content

Commit

Permalink
1.5.0: Made column changes to be one per migration to support sqlite
Browse files Browse the repository at this point in the history
- Fixed bug causing seeding to not work
  • Loading branch information
Ben Freke committed Apr 30, 2017
1 parent c4a3bc8 commit cb71d83
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 8 deletions.
9 changes: 7 additions & 2 deletions models/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,16 @@ public function beforeSave()
*/
public function setUrlAttribute($value)
{
if ( $this->is_external ) {
$urlValue = null;
if ( $this->is_external && !empty($this->external_url) ) {
$urlValue = $this->external_url;
} else {
} elseif (!$this->is_external && !empty($this->internal_url)) {
$urlValue = $this->internal_url;
}
// Allow seeding
if (empty($urlValue) && !empty($value)) {
$urlValue = $value;
}
$this->attributes['url'] = $urlValue;
}
}
25 changes: 25 additions & 0 deletions updates/add_enabled_parameters_query_fields_1.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php namespace BenFreke\MenuManager\Updates;

use Schema;
use October\Rain\Database\Updates\Migration;

class AddEnabledParametersQueryFields1 extends Migration
{

public function up()
{
Schema::table('benfreke_menumanager_menus', function($table)
{
$table->integer('enabled')->default(1);
});
}

public function down()
{
Schema::table('benfreke_menumanager_menus', function($table)
{
$table->dropColumn('enabled');
});
}

}
25 changes: 25 additions & 0 deletions updates/add_enabled_parameters_query_fields_2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php namespace BenFreke\MenuManager\Updates;

use Schema;
use October\Rain\Database\Updates\Migration;

class AddEnabledParametersQueryFields2 extends Migration
{

public function up()
{
Schema::table('benfreke_menumanager_menus', function($table)
{
$table->string('parameters')->nullable();
});
}

public function down()
{
Schema::table('benfreke_menumanager_menus', function($table)
{
$table->dropColumn('parameters');
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
use Schema;
use October\Rain\Database\Updates\Migration;

class AddEnabledParametersQueryFields extends Migration
class AddEnabledParametersQueryFields3 extends Migration
{

public function up()
{
Schema::table('benfreke_menumanager_menus', function($table)
{
$table->integer('enabled')->default(1);
$table->string('parameters')->nullable();
$table->string('query_string')->nullable();
});
}
Expand All @@ -20,8 +18,6 @@ public function down()
{
Schema::table('benfreke_menumanager_menus', function($table)
{
$table->dropColumn('enabled');
$table->dropColumn('parameters');
$table->dropColumn('query_string');
});
}
Expand Down
4 changes: 3 additions & 1 deletion updates/version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
- add_link_target_field.php
1.1.1:
- Added ability to enable/disable individual menu links; Added ability for url parameters & query string; Fixed issue of "getLinkHref()" pulling through full page url with parameters rather than the ACTUAL page url
- add_enabled_parameters_query_fields.php
- add_enabled_parameters_query_fields_1.php
- add_enabled_parameters_query_fields_2.php
- add_enabled_parameters_query_fields_3.php
1.1.2:
- Reformatted code for better maintainability and better practises
1.1.3:
Expand Down

0 comments on commit cb71d83

Please sign in to comment.