Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration laravel 9 above version #5801

Open
wants to merge 2 commits into
base: 1.6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions migrations/2016_01_01_000000_add_voyager_user_fields.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddVoyagerUserFields extends Migration
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::table('users', function ($table) {
Schema::table('users', function (Blueprint $table) {
if (!Schema::hasColumn('users', 'avatar')) {
$table->string('avatar')->nullable()->after('email')->default('users/default.png');
$table->string('test')->nullable()->after('email')->default('users/default.png');
}
$table->bigInteger('role_id')->nullable()->after('id');
});
Expand All @@ -23,14 +26,14 @@ public function up()
public function down()
{
if (Schema::hasColumn('users', 'avatar')) {
Schema::table('users', function ($table) {
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('avatar');
});
}
if (Schema::hasColumn('users', 'role_id')) {
Schema::table('users', function ($table) {
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('role_id');
});
}
}
}
};
5 changes: 3 additions & 2 deletions migrations/2016_01_01_000000_create_data_types_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateDataTypesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -56,4 +57,4 @@ public function down()
Schema::drop('data_rows');
Schema::drop('data_types');
}
}
};
5 changes: 3 additions & 2 deletions migrations/2016_05_19_173453_create_menu_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMenuTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -46,4 +47,4 @@ public function down()
Schema::drop('menu_items');
Schema::drop('menus');
}
}
};
4 changes: 2 additions & 2 deletions migrations/2016_10_21_190000_create_roles_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateRolesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -30,4 +30,4 @@ public function down()
{
Schema::drop('roles');
}
}
};
4 changes: 2 additions & 2 deletions migrations/2016_10_21_190000_create_settings_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSettingsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -33,4 +33,4 @@ public function down()
{
Schema::dropIfExists('settings');
}
}
};
4 changes: 2 additions & 2 deletions migrations/2016_11_30_135954_create_permission_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePermissionTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -30,4 +30,4 @@ public function down()
{
Schema::dropIfExists('permissions');
}
}
};
4 changes: 2 additions & 2 deletions migrations/2016_11_30_141208_create_permission_role_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePermissionRoleTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -31,4 +31,4 @@ public function down()
{
Schema::dropIfExists('permission_role');
}
}
};
4 changes: 2 additions & 2 deletions migrations/2016_12_26_201236_data_types__add__server_side.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class DataTypesAddServerSide extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -29,4 +29,4 @@ public function down()
$table->dropColumn('server_side');
});
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddRouteToMenuItemsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -38,4 +38,4 @@ public function down()
});
}
}
}
};
4 changes: 2 additions & 2 deletions migrations/2017_01_14_005015_create_translations_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTranslationsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -38,4 +38,4 @@ public function down()
{
Schema::dropIfExists('translations');
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class MakeTableNameNullableInPermissionsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -27,4 +27,4 @@ public function down()
{
//
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddControllerToDataTypesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -29,4 +29,4 @@ public function down()
$table->dropColumn('controller');
});
}
}
};
4 changes: 2 additions & 2 deletions migrations/2017_04_21_000000_add_order_to_data_rows_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddOrderToDataRowsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -29,4 +29,4 @@ public function down()
$table->dropColumn('order');
});
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddPolicyNameToDataTypesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -28,4 +29,4 @@ public function down()
$table->dropColumn('policy_name');
});
}
}
};
4 changes: 2 additions & 2 deletions migrations/2017_08_05_000000_add_group_to_settings_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddGroupToSettingsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -29,4 +29,4 @@ public function down()
$table->dropColumn('group');
});
}
}
};
4 changes: 2 additions & 2 deletions migrations/2017_11_26_013050_add_user_role_relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddUserRoleRelationship extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -34,4 +34,4 @@ public function down()
$table->bigInteger('role_id')->change();
});
}
}
};
5 changes: 3 additions & 2 deletions migrations/2017_11_26_015000_create_user_roles_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class CreateUserRolesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -37,4 +38,4 @@ public function down()
{
Schema::dropIfExists('user_roles');
}
}
};
4 changes: 2 additions & 2 deletions migrations/2018_03_11_000000_add_user_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddUserSettings extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -29,4 +29,4 @@ public function down()
$table->dropColumn('settings');
});
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddDetailsToDatatypesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -29,4 +29,4 @@ public function down()
$table->dropColumn('details');
});
}
}
};
4 changes: 2 additions & 2 deletions migrations/2018_03_16_000000_make_settings_value_nullable.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class MakeSettingsValueNullable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -32,4 +32,4 @@ public function down()
$table->text('value')->nullable(false)->change();
});
}
}
};
4 changes: 4 additions & 0 deletions resources/views/bread/browse.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,11 @@
<span class="badge badge-lg" style="background-color: {{ $data->{$row->field} }}">{{ $data->{$row->field} }}</span>
@elseif($row->type == 'text')
@include('voyager::multilingual.input-hidden-bread-browse')
@if (!in_array(gettype($data->{$row->field}),['object','array']))
<div>{{ mb_strlen( $data->{$row->field} ) > 200 ? mb_substr($data->{$row->field}, 0, 200) . ' ...' : $data->{$row->field} }}</div>
@else
<div>{{ json_encode($data->{$row->field}) }}</div>
@endif
@elseif($row->type == 'text_area')
@include('voyager::multilingual.input-hidden-bread-browse')
<div>{{ mb_strlen( $data->{$row->field} ) > 200 ? mb_substr($data->{$row->field}, 0, 200) . ' ...' : $data->{$row->field} }}</div>
Expand Down