mirror of
https://github.com/twinpath/app.git
synced 2026-01-26 05:15:28 +07:00
chore: cleanup project structure and update readme for beta release
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?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
|
||||
{
|
||||
Schema::dropIfExists('legal_page_revisions');
|
||||
Schema::dropIfExists('legal_pages');
|
||||
|
||||
Schema::create('legal_pages', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title');
|
||||
$table->string('slug')->unique();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('legal_page_revisions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('legal_page_id')->constrained()->onDelete('cascade');
|
||||
$table->longText('content');
|
||||
$table->string('version')->default('1.0');
|
||||
$table->text('change_log')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('legal_page_revisions');
|
||||
Schema::dropIfExists('legal_pages');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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
|
||||
{
|
||||
Schema::create('contact_submissions', function (Blueprint $table) {
|
||||
$table->ulid('id')->primary();
|
||||
$table->string('name');
|
||||
$table->string('email');
|
||||
$table->string('category');
|
||||
$table->string('subject');
|
||||
$table->text('message');
|
||||
$table->boolean('is_read')->default(false);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('contact_submissions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
<?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
|
||||
{
|
||||
Schema::create('tickets', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('user_id', 32)->index();
|
||||
$table->string('ticket_number')->unique();
|
||||
$table->string('subject');
|
||||
$table->string('category'); // Technical, Billing, etc.
|
||||
$table->enum('priority', ['low', 'medium', 'high'])->default('medium');
|
||||
$table->enum('status', ['open', 'answered', 'closed'])->default('open');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
});
|
||||
|
||||
Schema::create('ticket_replies', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->foreignUuid('ticket_id')->constrained()->onDelete('cascade');
|
||||
$table->string('user_id', 32)->index();
|
||||
$table->text('message');
|
||||
$table->string('attachment_path')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('ticket_replies');
|
||||
Schema::dropIfExists('tickets');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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
|
||||
{
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('type');
|
||||
$table->morphs('notifiable');
|
||||
$table->text('data');
|
||||
$table->timestamp('read_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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
|
||||
{
|
||||
Schema::table('notifications', function (Blueprint $table) {
|
||||
$table->string('notifiable_id')->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('notifications', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('notifiable_id')->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -23,7 +23,14 @@ class DatabaseSeeder extends Seeder
|
||||
['label' => 'Customer']
|
||||
);
|
||||
|
||||
// Create Admin User
|
||||
// Helper to generate avatar
|
||||
$generateAvatar = function ($name, $email) {
|
||||
$filename = 'avatars/' . \Illuminate\Support\Str::slug($email) . '_' . time() . '.png';
|
||||
$avatar = \Laravolt\Avatar\Facade::create($name)->getImageObject()->encode(new \Intervention\Image\Encoders\PngEncoder());
|
||||
\Illuminate\Support\Facades\Storage::disk('public')->put($filename, $avatar);
|
||||
return $filename;
|
||||
};
|
||||
|
||||
// Create Admin User
|
||||
User::firstOrCreate(
|
||||
['email' => 'admin@dyzulk.com'],
|
||||
@@ -33,18 +40,20 @@ class DatabaseSeeder extends Seeder
|
||||
'password' => \Illuminate\Support\Facades\Hash::make('password'),
|
||||
'role_id' => $adminRole->id,
|
||||
'email_verified_at' => now(),
|
||||
'avatar' => $generateAvatar('Admin User', 'admin@dyzulk.com'),
|
||||
]
|
||||
);
|
||||
|
||||
// Create Regular User
|
||||
// Create Regular User
|
||||
User::firstOrCreate(
|
||||
['email' => 'test@example.com'],
|
||||
['email' => 'user@dyzulk.com'],
|
||||
[
|
||||
'first_name' => 'Test',
|
||||
'last_name' => 'User',
|
||||
'first_name' => 'User',
|
||||
'last_name' => 'Customer',
|
||||
'password' => \Illuminate\Support\Facades\Hash::make('password'),
|
||||
'role_id' => $customerRole->id,
|
||||
'email_verified_at' => now(),
|
||||
'avatar' => $generateAvatar('User Customer', 'user@dyzulk.com'),
|
||||
]
|
||||
);
|
||||
|
||||
@@ -58,5 +67,8 @@ class DatabaseSeeder extends Seeder
|
||||
// 'role_id' => $customerRole->id,
|
||||
// ]
|
||||
// );
|
||||
$this->call([
|
||||
LegalPageSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
42
database/seeders/LegalPageSeeder.php
Normal file
42
database/seeders/LegalPageSeeder.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use App\Models\LegalPage;
|
||||
use App\Models\LegalPageRevision;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class LegalPageSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
// 1. Terms and Conditions
|
||||
$terms = LegalPage::firstOrCreate(
|
||||
['slug' => 'terms-and-conditions'],
|
||||
['title' => 'Terms and Conditions']
|
||||
);
|
||||
|
||||
LegalPageRevision::create([
|
||||
'legal_page_id' => $terms->id,
|
||||
'version' => '1.0.0',
|
||||
'change_log' => 'Initial revision',
|
||||
'is_active' => true,
|
||||
'content' => "# Terms and Conditions\n\nWelcome to DyDev TrustLab. These terms outline the rules and regulations for the use of our services.\n\n## 1. Acceptable Use\nBy accessing this website, we assume you accept these terms and conditions. Do not continue to use TrustLab if you do not agree to all of the terms and conditions stated on this page.\n\n## 2. Intellectual Property\nUnless otherwise stated, TrustLab and/or its licensors own the intellectual property rights for all material on TrustLab.\n\n## Contact Us\nIf you have any questions about these Terms, please contact us at **info@dydev.com** or via our [Contact Form](/contact)."
|
||||
]);
|
||||
|
||||
// 2. Privacy Policy
|
||||
$privacy = LegalPage::firstOrCreate(
|
||||
['slug' => 'privacy-policy'],
|
||||
['title' => 'Privacy Policy']
|
||||
);
|
||||
|
||||
LegalPageRevision::create([
|
||||
'legal_page_id' => $privacy->id,
|
||||
'version' => '1.0.0',
|
||||
'change_log' => 'Initial revision',
|
||||
'is_active' => true,
|
||||
'content' => "# Privacy Policy\n\nYour privacy is important to us. It is TrustLab's policy to respect your privacy regarding any information we may collect from you across our website.\n\n## 1. Information We Collect\nWe only ask for personal information when we truly need it to provide a service to you.\n\n## 2. Data Security\nWe protect your data within commercially acceptable means to prevent loss and theft.\n\n## Contact Us\nIf you have any questions about how we handle user data and personal information, please contact us at **privacy@dydev.com** or via our [Contact Form](/contact)."
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user