feat: implement column descriptions table, seed default system types and user levels, and add admin account creation command
This commit is contained in:
@@ -36,6 +36,7 @@ class CreateAdmin extends Command
|
||||
if ($user) {
|
||||
$user->password = Hash::make($password);
|
||||
$user->level = 'Admin';
|
||||
$user->permissions = 'users,languages,contents,new,fields,search,ALL PRIVILEGES';
|
||||
$user->save();
|
||||
$status = 'updated';
|
||||
} else {
|
||||
@@ -44,6 +45,7 @@ class CreateAdmin extends Command
|
||||
$user->email = $email;
|
||||
$user->password = Hash::make($password);
|
||||
$user->level = 'Admin';
|
||||
$user->permissions = 'users,languages,contents,new,fields,search,ALL PRIVILEGES';
|
||||
$user->save();
|
||||
$status = 'created';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$types = [
|
||||
[
|
||||
'title' => 'Settings',
|
||||
'slug' => 'settings',
|
||||
'icon' => 'setting',
|
||||
'kid' => null,
|
||||
's' => 101,
|
||||
'full_control' => '1,',
|
||||
'write' => '1,24,2,3,7,8,10,13,19',
|
||||
'read' => '1,24,2,3,7,8,10,13,19,22,23,26',
|
||||
'modify' => '1,2,3,7,8,10,13',
|
||||
],
|
||||
[
|
||||
'title' => 'General Settings',
|
||||
'slug' => 'general-settings',
|
||||
'icon' => 'setting',
|
||||
'kid' => 'settings',
|
||||
's' => 0,
|
||||
'full_control' => '1',
|
||||
'write' => '1,2,13',
|
||||
'read' => '1,2,3,8',
|
||||
'modify' => '1,2',
|
||||
],
|
||||
[
|
||||
'title' => 'Batch Excel',
|
||||
'slug' => 'batch-excel',
|
||||
'icon' => 'batch-processing',
|
||||
'kid' => 'settings',
|
||||
's' => null,
|
||||
'full_control' => '1,7',
|
||||
'write' => '1,2,3,7,8,13,19',
|
||||
'read' => '1,24,2,3,7,8,10,12,13,19,22,23,26',
|
||||
'modify' => '1,2,3,7,8,10,12,13,19',
|
||||
],
|
||||
[
|
||||
'title' => 'Document Manager',
|
||||
'slug' => 'document-manager',
|
||||
'icon' => 'folder-management',
|
||||
'kid' => 'documentation',
|
||||
's' => 103,
|
||||
'full_control' => '1',
|
||||
'write' => '1,24,2,8,12,14,22',
|
||||
'read' => '1,24,2,3,7,8,9,10,12,13,14,19,22,23',
|
||||
'modify' => '1,2,3,7,8,12,13,14,19,22',
|
||||
],
|
||||
[
|
||||
'title' => 'Document Templates',
|
||||
'slug' => 'document-templates',
|
||||
'icon' => 'document-template',
|
||||
'kid' => 'settings',
|
||||
's' => null,
|
||||
'full_control' => '1',
|
||||
'write' => '1,24,2',
|
||||
'read' => '1,24,2,8,12',
|
||||
'modify' => '1,2',
|
||||
],
|
||||
[
|
||||
'title' => 'Predefined Variables',
|
||||
'slug' => 'predefined-variables',
|
||||
'icon' => 'setting',
|
||||
'kid' => 'settings',
|
||||
's' => 3,
|
||||
'full_control' => '1',
|
||||
'write' => '1,2,3',
|
||||
'read' => '1,2,3',
|
||||
'modify' => '1,2,3',
|
||||
],
|
||||
[
|
||||
'title' => 'System Information',
|
||||
'slug' => 'system-information',
|
||||
'icon' => 'system-cloud',
|
||||
'kid' => null,
|
||||
's' => 106,
|
||||
'full_control' => '1',
|
||||
'write' => '1',
|
||||
'read' => '1',
|
||||
'modify' => '1',
|
||||
],
|
||||
[
|
||||
'title' => 'Languages',
|
||||
'slug' => 'languages',
|
||||
'icon' => 'languages',
|
||||
'kid' => null,
|
||||
's' => 150,
|
||||
'full_control' => '1,',
|
||||
'write' => '1,',
|
||||
'read' => '1,24',
|
||||
'modify' => '1,',
|
||||
],
|
||||
[
|
||||
'title' => 'Report Builder',
|
||||
'slug' => 'report-builder',
|
||||
'icon' => 'reportbuilder',
|
||||
'kid' => 'documentation',
|
||||
's' => 2,
|
||||
'full_control' => '1,',
|
||||
'write' => '1,24,2,7,8,12,14,19,22,26',
|
||||
'read' => '1,24,2,7,8,12,14,19,22,23,26',
|
||||
'modify' => '1,2,7,8,12,14,19,22,26',
|
||||
],
|
||||
[
|
||||
'title' => 'My Notifications',
|
||||
'slug' => 'my-notifications',
|
||||
'icon' => 'notification',
|
||||
'kid' => null,
|
||||
's' => 99,
|
||||
'full_control' => '1',
|
||||
'write' => '1,24,2,7,17,19',
|
||||
'read' => '1,24,2,7,9,14,17,19,22,26',
|
||||
'modify' => '1,24,2,7,14,19',
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($types as $type) {
|
||||
DB::table('types')->updateOrInsert(
|
||||
['slug' => $type['slug']],
|
||||
array_merge($type, [
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
'enabled' => 1,
|
||||
'is_mobile' => 0,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
$slugs = [
|
||||
'settings',
|
||||
'general-settings',
|
||||
'batch-excel',
|
||||
'document-manager',
|
||||
'document-templates',
|
||||
'predefined-variables',
|
||||
'system-information',
|
||||
'languages',
|
||||
'report-builder',
|
||||
'my-notifications',
|
||||
];
|
||||
|
||||
DB::table('types')->whereIn('slug', $slugs)->delete();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$levels = [
|
||||
[1, '2023-12-22 15:30:14', '2023-12-23 06:35:24', 'Admin', 1, 1, 1, 1, 1, null],
|
||||
[2, '2023-12-22 15:30:14', '2025-10-06 11:20:18', 'Manager (Center Office)', 24, 0, 1, 1, 1, 'siralama hatasi yeniden numara verildi'],
|
||||
[3, '2023-12-22 15:30:14', '2025-10-06 11:20:19', 'Manager (PTO)', 25, 1, 1, 1, 1, 'siralama hatasi yeniden numara verildi'],
|
||||
[4, '2023-12-22 15:30:14', '2025-10-06 10:52:00', 'Manager (Lead)', 2, 1, 1, 1, 1, null],
|
||||
[5, '2023-12-22 15:30:14', '2024-11-13 08:45:15', 'Welder (Subcontractor)', 3, 0, 1, 1, 0, null],
|
||||
[6, '2023-12-22 15:30:14', '2023-12-23 06:35:36', 'Painter (Subcontractor)', 4, 0, 0, 1, 0, null],
|
||||
[7, '2023-12-22 15:30:14', '2024-07-05 11:54:27', 'Insulator (Subcontractor)', 5, 0, 0, 1, 0, null],
|
||||
[8, '2023-12-22 15:30:14', '2024-07-05 11:55:11', 'Welder, Painter, Insulator (Subcontractor / Payrollless)', 6, 0, 1, 1, 1, null],
|
||||
[9, '2023-12-22 15:30:14', '2023-12-22 15:30:14', 'Quality Staff', 7, 0, 0, 1, 0, null],
|
||||
[10, '2023-12-22 15:30:14', '2023-12-25 13:06:45', 'Document Staff', 8, 0, 0, 1, 0, null],
|
||||
[11, '2023-12-22 15:30:14', '2025-10-06 11:19:22', 'Field Staff', 9, 0, 0, 1, 1, null],
|
||||
[12, '2023-12-23 06:33:31', '2023-12-26 09:26:39', 'Workshop(Subcontractor)', 10, 1, 1, 1, 1, null],
|
||||
[13, '2024-05-21 05:19:31', '2024-10-14 15:44:39', 'Data logger', 11, 0, 1, 1, 1, ''],
|
||||
[14, '2024-06-13 11:53:47', '2024-06-13 12:16:19', 'Data Operator', 12, 0, 1, 1, 1, ''],
|
||||
[16, '2024-06-20 19:29:27', '2024-10-14 15:44:15', 'Test Pack Engineer', 13, 1, 1, 1, 1, ''],
|
||||
[17, '2024-07-04 12:14:21', '2024-07-04 12:15:10', 'Welding Engineer', 14, 0, 1, 1, 1, ''],
|
||||
[18, '2024-09-20 11:29:49', '2024-10-14 15:43:20', 'Subcontractor', 15, 0, 1, 1, 1, ''],
|
||||
[19, '2024-10-14 15:43:55', '2024-10-14 15:43:55', 'Technical Office', 16, 0, 1, 1, 1, ''],
|
||||
[20, '2024-11-13 08:44:01', '2024-11-13 08:54:37', 'Welding inspector', 17, 0, 1, 1, 1, ''],
|
||||
[21, '2024-11-13 08:44:14', '2024-11-13 08:54:41', 'Piping Inspector', 18, 0, 1, 1, 1, ''],
|
||||
[22, '2024-11-13 08:53:48', '2024-11-13 08:54:46', 'Chief Engineer(QC)', 19, 0, 1, 1, 1, ''],
|
||||
[23, '2024-11-13 08:54:01', '2024-11-13 08:54:48', 'Chief Engineer(Field)', 20, 0, 1, 1, 1, ''],
|
||||
[24, '2024-11-13 08:55:05', '2024-11-13 08:55:15', 'Client', 21, 0, 0, 1, 0, ''],
|
||||
[25, '2024-11-13 10:13:11', '2025-04-30 06:50:55', 'PTO engineer', 22, 1, 1, 1, 1, ''],
|
||||
[26, '2025-04-30 07:02:07', '2025-10-06 10:52:12', 'Display', 23, 0, 0, 1, 0, 'Ornek goruntuleme'],
|
||||
[28, '2025-10-06 11:20:21', '2025-10-06 11:21:04', 'PTO Chief Engineer', 26, 0, 1, 1, 1, ''],
|
||||
[29, '2026-03-16 12:54:20', null, 'NDT', 28, 0, 0, 1, 0, null],
|
||||
];
|
||||
|
||||
foreach ($levels as $level) {
|
||||
DB::table('user_levels')->updateOrInsert(
|
||||
['id' => $level[0]],
|
||||
[
|
||||
'created_at' => $level[1],
|
||||
'updated_at' => $level[2],
|
||||
'title' => $level[3],
|
||||
'level_index' => $level[4],
|
||||
'full_control' => $level[5],
|
||||
'write' => $level[6],
|
||||
'read' => $level[7],
|
||||
'modify' => $level[8],
|
||||
'description' => $level[9],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
DB::table('user_levels')->truncate();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (!Schema::hasTable('column_descriptions')) {
|
||||
Schema::create('column_descriptions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
$table->string('module_name', 100)->nullable();
|
||||
$table->string('column_name', 100)->nullable();
|
||||
$table->string('description', 100)->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('column_descriptions');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user