feat(settings): add menu/show_to_user and public get_settings for client apps
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('settings')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('settings', 'menu')) {
|
||||
$table->string('menu', 64)->nullable()->after('can_edit');
|
||||
}
|
||||
if (! Schema::hasColumn('settings', 'show_to_user')) {
|
||||
$table->boolean('show_to_user')->default(false)->after('menu');
|
||||
}
|
||||
});
|
||||
|
||||
$path = database_path('sql/settings_menu_and_show_to_user.sql');
|
||||
if (is_file($path)) {
|
||||
DB::unprepared((string) file_get_contents($path));
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (! Schema::hasTable('settings')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('settings', 'show_to_user')) {
|
||||
$table->dropColumn('show_to_user');
|
||||
}
|
||||
if (Schema::hasColumn('settings', 'menu')) {
|
||||
$table->dropColumn('menu');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user