init commit
This commit is contained in:
1
database/.gitignore
vendored
Normal file
1
database/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
295
database/factories/ResumeFactory.php
Normal file
295
database/factories/ResumeFactory.php
Normal file
@@ -0,0 +1,295 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Resume>
|
||||
*/
|
||||
class ResumeFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$templates = ['professional', 'modern', 'executive', 'minimal', 'technical'];
|
||||
$statuses = ['draft', 'published', 'archived'];
|
||||
|
||||
return [
|
||||
'user_id' => User::factory(),
|
||||
'title' => fake()->sentence(3),
|
||||
'description' => fake()->paragraph(),
|
||||
'template' => fake()->randomElement($templates),
|
||||
'content' => $this->generateSampleContent(),
|
||||
'settings' => $this->generateSettings(),
|
||||
'status' => fake()->randomElement($statuses),
|
||||
'is_public' => fake()->boolean(30), // 30% chance of being public
|
||||
'public_url' => fake()->optional(0.3)->slug(),
|
||||
'published_at' => fake()->optional(0.5)->dateTimeBetween('-6 months', 'now'),
|
||||
'view_count' => fake()->numberBetween(0, 1000),
|
||||
'download_count' => fake()->numberBetween(0, 100),
|
||||
'last_viewed_at' => fake()->optional(0.7)->dateTimeBetween('-1 month', 'now'),
|
||||
'last_downloaded_at' => fake()->optional(0.4)->dateTimeBetween('-1 month', 'now'),
|
||||
'completion_percentage' => fake()->numberBetween(25, 100),
|
||||
'completion_sections' => $this->generateCompletionSections(),
|
||||
'analytics' => [
|
||||
'total_views' => fake()->numberBetween(0, 1000),
|
||||
'unique_visitors' => fake()->numberBetween(0, 500),
|
||||
'avg_time_on_page' => fake()->numberBetween(30, 300),
|
||||
'bounce_rate' => fake()->randomFloat(2, 0, 1),
|
||||
],
|
||||
'allow_comments' => fake()->boolean(20),
|
||||
'expires_at' => fake()->optional(0.2)->dateTimeBetween('now', '+1 year'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate sample resume content.
|
||||
*/
|
||||
private function generateSampleContent(): array
|
||||
{
|
||||
return [
|
||||
'personal_info' => [
|
||||
'full_name' => fake()->name(),
|
||||
'title' => fake()->jobTitle(),
|
||||
'email' => fake()->email(),
|
||||
'phone' => fake()->phoneNumber(),
|
||||
'location' => fake()->city() . ', ' . fake()->country(),
|
||||
'website' => fake()->optional()->url(),
|
||||
'linkedin' => fake()->optional()->url(),
|
||||
'github' => fake()->optional()->url(),
|
||||
],
|
||||
'summary' => fake()->paragraph(4),
|
||||
'experience' => $this->generateExperience(),
|
||||
'education' => $this->generateEducation(),
|
||||
'skills' => $this->generateSkills(),
|
||||
'projects' => fake()->optional(0.7)->passthrough($this->generateProjects()),
|
||||
'certifications' => fake()->optional(0.5)->passthrough($this->generateCertifications()),
|
||||
'languages' => fake()->optional(0.6)->passthrough($this->generateLanguages()),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate work experience.
|
||||
*/
|
||||
private function generateExperience(): array
|
||||
{
|
||||
$experiences = [];
|
||||
$count = fake()->numberBetween(1, 4);
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$startDate = fake()->dateTimeBetween('-10 years', '-1 year');
|
||||
$isCurrent = $i === 0 && fake()->boolean(40);
|
||||
|
||||
$experiences[] = [
|
||||
'company' => fake()->company(),
|
||||
'position' => fake()->jobTitle(),
|
||||
'location' => fake()->city() . ', ' . fake()->country(),
|
||||
'start_date' => $startDate->format('Y-m-d'),
|
||||
'end_date' => $isCurrent ? null : fake()->dateTimeBetween($startDate, 'now')->format('Y-m-d'),
|
||||
'current' => $isCurrent,
|
||||
'description' => fake()->paragraph(2),
|
||||
'achievements' => fake()->sentences(fake()->numberBetween(2, 5)),
|
||||
];
|
||||
}
|
||||
|
||||
return $experiences;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate education.
|
||||
*/
|
||||
private function generateEducation(): array
|
||||
{
|
||||
$education = [];
|
||||
$count = fake()->numberBetween(1, 3);
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$startDate = fake()->dateTimeBetween('-15 years', '-2 years');
|
||||
$endDate = fake()->dateTimeBetween($startDate, '-1 year');
|
||||
|
||||
$education[] = [
|
||||
'institution' => fake()->company() . ' University',
|
||||
'degree' => fake()->randomElement(['Bachelor of Science', 'Master of Science', 'Bachelor of Arts', 'Master of Arts']),
|
||||
'field' => fake()->randomElement(['Computer Science', 'Information Technology', 'Software Engineering', 'Business Administration']),
|
||||
'start_date' => $startDate->format('Y-m-d'),
|
||||
'end_date' => $endDate->format('Y-m-d'),
|
||||
'gpa' => fake()->optional(0.7)->randomFloat(1, 2.5, 4.0),
|
||||
'description' => fake()->optional(0.5)->sentence(),
|
||||
];
|
||||
}
|
||||
|
||||
return $education;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate skills.
|
||||
*/
|
||||
private function generateSkills(): array
|
||||
{
|
||||
$skillCategories = [
|
||||
'Programming Languages' => ['PHP', 'JavaScript', 'Python', 'Java', 'TypeScript'],
|
||||
'Frontend' => ['React', 'Angular', 'Vue.js', 'HTML5', 'CSS3', 'Bootstrap'],
|
||||
'Backend' => ['Laravel', 'Node.js', 'Express', 'Django', 'Spring Boot'],
|
||||
'Databases' => ['MySQL', 'PostgreSQL', 'MongoDB', 'Redis'],
|
||||
'Tools & Technologies' => ['Git', 'Docker', 'AWS', 'Linux', 'Jenkins'],
|
||||
];
|
||||
|
||||
$skills = [];
|
||||
$numCategories = fake()->numberBetween(2, 5);
|
||||
$categories = fake()->randomElements(array_keys($skillCategories), $numCategories);
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$skills[$category] = fake()->randomElements($skillCategories[$category], fake()->numberBetween(2, 4));
|
||||
}
|
||||
|
||||
return $skills;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate projects.
|
||||
*/
|
||||
private function generateProjects(): array
|
||||
{
|
||||
$projects = [];
|
||||
$count = fake()->numberBetween(1, 4);
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$projects[] = [
|
||||
'name' => fake()->catchPhrase(),
|
||||
'description' => fake()->paragraph(),
|
||||
'technologies' => fake()->randomElements(['Laravel', 'React', 'Vue.js', 'MySQL', 'Docker', 'AWS'], fake()->numberBetween(2, 4)),
|
||||
'url' => fake()->optional(0.6)->url(),
|
||||
'achievements' => fake()->sentences(fake()->numberBetween(2, 4)),
|
||||
];
|
||||
}
|
||||
|
||||
return $projects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate certifications.
|
||||
*/
|
||||
private function generateCertifications(): array
|
||||
{
|
||||
$certifications = [];
|
||||
$count = fake()->numberBetween(1, 3);
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$certifications[] = [
|
||||
'name' => fake()->sentence(4),
|
||||
'issuer' => fake()->company(),
|
||||
'date' => fake()->dateTimeBetween('-5 years', 'now')->format('Y-m-d'),
|
||||
'credential_id' => fake()->optional(0.7)->bothify('??###-####'),
|
||||
'url' => fake()->optional(0.5)->url(),
|
||||
];
|
||||
}
|
||||
|
||||
return $certifications;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate languages.
|
||||
*/
|
||||
private function generateLanguages(): array
|
||||
{
|
||||
$languages = ['English', 'Spanish', 'French', 'German', 'Italian', 'Portuguese', 'Chinese', 'Japanese'];
|
||||
$levels = ['Native', 'Fluent', 'Advanced', 'Intermediate', 'Basic'];
|
||||
|
||||
$result = [];
|
||||
$count = fake()->numberBetween(1, 4);
|
||||
$selectedLanguages = fake()->randomElements($languages, $count);
|
||||
|
||||
foreach ($selectedLanguages as $language) {
|
||||
$result[] = [
|
||||
'language' => $language,
|
||||
'level' => fake()->randomElement($levels),
|
||||
];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate settings.
|
||||
*/
|
||||
private function generateSettings(): array
|
||||
{
|
||||
return [
|
||||
'color_scheme' => fake()->randomElement(['blue', 'green', 'red', 'purple', 'orange']),
|
||||
'font_family' => fake()->randomElement(['Arial', 'Times New Roman', 'Calibri', 'Helvetica']),
|
||||
'font_size' => fake()->numberBetween(9, 12),
|
||||
'line_spacing' => fake()->randomFloat(1, 1.0, 1.5),
|
||||
'margin' => fake()->numberBetween(15, 25),
|
||||
'show_photo' => fake()->boolean(30),
|
||||
'section_order' => ['summary', 'experience', 'education', 'skills', 'projects', 'certifications', 'languages'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate completion sections.
|
||||
*/
|
||||
private function generateCompletionSections(): array
|
||||
{
|
||||
$sections = ['personal_info', 'summary', 'experience', 'education', 'skills', 'projects', 'certifications', 'languages'];
|
||||
$completed = [];
|
||||
|
||||
foreach ($sections as $section) {
|
||||
$completed[$section] = fake()->boolean(80); // 80% chance of being completed
|
||||
}
|
||||
|
||||
return $completed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the resume is published.
|
||||
*/
|
||||
public function published()
|
||||
{
|
||||
return $this->state(function (array $attributes) {
|
||||
return [
|
||||
'status' => 'published',
|
||||
'published_at' => fake()->dateTimeBetween('-6 months', 'now'),
|
||||
'is_public' => true,
|
||||
'public_url' => fake()->slug(),
|
||||
'completion_percentage' => fake()->numberBetween(80, 100),
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the resume is a draft.
|
||||
*/
|
||||
public function draft()
|
||||
{
|
||||
return $this->state(function (array $attributes) {
|
||||
return [
|
||||
'status' => 'draft',
|
||||
'published_at' => null,
|
||||
'is_public' => false,
|
||||
'public_url' => null,
|
||||
'completion_percentage' => fake()->numberBetween(25, 75),
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the resume is popular.
|
||||
*/
|
||||
public function popular()
|
||||
{
|
||||
return $this->state(function (array $attributes) {
|
||||
return [
|
||||
'view_count' => fake()->numberBetween(500, 5000),
|
||||
'download_count' => fake()->numberBetween(50, 500),
|
||||
'is_public' => true,
|
||||
'status' => 'published',
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
97
database/factories/UserFactory.php
Normal file
97
database/factories/UserFactory.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'first_name' => fake()->firstName(),
|
||||
'last_name' => fake()->lastName(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'phone' => fake()->phoneNumber(),
|
||||
'date_of_birth' => fake()->date('Y-m-d', '2000-01-01'),
|
||||
'gender' => fake()->randomElement(['male', 'female', 'other', 'prefer_not_to_say']),
|
||||
'bio' => fake()->paragraph(3),
|
||||
'website' => fake()->url(),
|
||||
'linkedin' => 'https://linkedin.com/in/' . fake()->userName(),
|
||||
'github' => 'https://github.com/' . fake()->userName(),
|
||||
'twitter' => 'https://twitter.com/' . fake()->userName(),
|
||||
'preferences' => [
|
||||
'theme' => fake()->randomElement(['professional', 'modern', 'minimal']),
|
||||
'language' => fake()->randomElement(['en', 'de', 'es', 'fr']),
|
||||
'notifications' => fake()->boolean(),
|
||||
'marketing_emails' => fake()->boolean(),
|
||||
],
|
||||
'newsletter_subscribed' => fake()->boolean(),
|
||||
'last_login_at' => fake()->optional()->dateTimeBetween('-1 month', 'now'),
|
||||
'last_login_ip' => fake()->ipv4(),
|
||||
'status' => fake()->randomElement(['active', 'inactive']),
|
||||
'locale' => fake()->randomElement(['en', 'de', 'es', 'fr']),
|
||||
'timezone' => fake()->timezone(),
|
||||
'profile_completed_at' => fake()->optional(0.8)->dateTimeBetween('-1 month', 'now'),
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified()
|
||||
{
|
||||
return $this->state(function (array $attributes) {
|
||||
return [
|
||||
'email_verified_at' => null,
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the user is suspended.
|
||||
*/
|
||||
public function suspended()
|
||||
{
|
||||
return $this->state(function (array $attributes) {
|
||||
return [
|
||||
'status' => 'suspended',
|
||||
'suspended_at' => now(),
|
||||
'suspension_reason' => fake()->sentence(),
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the user has incomplete profile.
|
||||
*/
|
||||
public function incompleteProfile()
|
||||
{
|
||||
return $this->state(function (array $attributes) {
|
||||
return [
|
||||
'profile_completed_at' => null,
|
||||
'bio' => null,
|
||||
'website' => null,
|
||||
'phone' => null,
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
63
database/migrations/2024_01_01_000000_create_users_table.php
Normal file
63
database/migrations/2024_01_01_000000_create_users_table.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?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('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('first_name');
|
||||
$table->string('last_name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->string('phone')->nullable();
|
||||
$table->date('date_of_birth')->nullable();
|
||||
$table->enum('gender', ['male', 'female', 'other', 'prefer_not_to_say'])->nullable();
|
||||
$table->string('avatar')->nullable();
|
||||
$table->text('bio')->nullable();
|
||||
$table->string('website')->nullable();
|
||||
$table->string('linkedin')->nullable();
|
||||
$table->string('github')->nullable();
|
||||
$table->string('twitter')->nullable();
|
||||
$table->json('preferences')->nullable(); // User preferences as JSON
|
||||
$table->boolean('newsletter_subscribed')->default(false);
|
||||
$table->timestamp('last_login_at')->nullable();
|
||||
$table->string('last_login_ip')->nullable();
|
||||
$table->enum('status', ['active', 'inactive', 'suspended'])->default('active');
|
||||
$table->timestamp('suspended_at')->nullable();
|
||||
$table->string('suspension_reason')->nullable();
|
||||
$table->integer('login_attempts')->default(0);
|
||||
$table->timestamp('locked_until')->nullable();
|
||||
$table->string('locale', 10)->default('en');
|
||||
$table->string('timezone', 50)->default('UTC');
|
||||
$table->boolean('two_factor_enabled')->default(false);
|
||||
$table->string('two_factor_secret')->nullable();
|
||||
$table->json('two_factor_recovery_codes')->nullable();
|
||||
$table->timestamp('profile_completed_at')->nullable();
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
|
||||
// Indexes for performance
|
||||
$table->index(['email', 'status']);
|
||||
$table->index(['last_login_at']);
|
||||
$table->index(['created_at']);
|
||||
$table->index(['status']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
|
||||
$table->index(['email', 'token']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->string('queue', 191); // Changed from text to string with length
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
|
||||
$table->index(['failed_at']);
|
||||
$table->index(['queue']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,64 @@
|
||||
<?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('resumes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->onDelete('cascade');
|
||||
$table->string('title');
|
||||
$table->text('description')->nullable();
|
||||
$table->enum('template', ['professional', 'modern', 'executive', 'minimal', 'technical'])->default('professional');
|
||||
$table->json('content')->nullable(); // Resume content as JSON
|
||||
$table->json('settings')->nullable(); // Template settings as JSON
|
||||
$table->enum('status', ['draft', 'published', 'archived'])->default('draft');
|
||||
$table->boolean('is_public')->default(false);
|
||||
$table->string('public_url')->nullable()->unique();
|
||||
$table->timestamp('published_at')->nullable();
|
||||
$table->integer('view_count')->default(0);
|
||||
$table->integer('download_count')->default(0);
|
||||
$table->timestamp('last_viewed_at')->nullable();
|
||||
$table->timestamp('last_downloaded_at')->nullable();
|
||||
$table->integer('completion_percentage')->default(0);
|
||||
$table->json('completion_sections')->nullable(); // Which sections are complete
|
||||
$table->string('pdf_path')->nullable(); // Path to generated PDF
|
||||
$table->timestamp('pdf_generated_at')->nullable();
|
||||
$table->integer('pdf_version')->default(1);
|
||||
$table->json('analytics')->nullable(); // Analytics data
|
||||
$table->json('feedback')->nullable(); // User feedback/notes
|
||||
$table->boolean('allow_comments')->default(false);
|
||||
$table->string('password')->nullable(); // Password protection
|
||||
$table->timestamp('expires_at')->nullable(); // Public link expiration
|
||||
$table->json('share_settings')->nullable(); // Sharing permissions
|
||||
$table->string('slug')->nullable(); // SEO-friendly URL
|
||||
$table->json('seo_meta')->nullable(); // SEO metadata
|
||||
$table->timestamps();
|
||||
$table->softDeletes(); // Soft delete for data recovery
|
||||
|
||||
// Indexes for performance
|
||||
$table->index(['user_id', 'status']);
|
||||
$table->index(['is_public', 'published_at']);
|
||||
$table->index(['template']);
|
||||
$table->index(['created_at']);
|
||||
$table->index(['view_count']);
|
||||
$table->index(['slug']);
|
||||
$table->index(['public_url']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('resumes');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
<?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('resume_views', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('resume_id')->constrained()->onDelete('cascade');
|
||||
$table->string('ip_address');
|
||||
$table->string('user_agent')->nullable();
|
||||
$table->string('referrer')->nullable();
|
||||
$table->string('country')->nullable();
|
||||
$table->string('city')->nullable();
|
||||
$table->json('browser_info')->nullable(); // Browser details
|
||||
$table->integer('duration')->nullable(); // Time spent viewing (seconds)
|
||||
$table->boolean('is_download')->default(false);
|
||||
$table->enum('format', ['web', 'pdf', 'docx'])->default('web');
|
||||
$table->timestamp('viewed_at');
|
||||
$table->timestamps();
|
||||
|
||||
// Indexes for analytics
|
||||
$table->index(['resume_id', 'viewed_at']);
|
||||
$table->index(['ip_address']);
|
||||
$table->index(['country']);
|
||||
$table->index(['is_download']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('resume_views');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?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('activity_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->nullable()->constrained()->onDelete('set null');
|
||||
$table->string('event'); // login, logout, resume_created, etc.
|
||||
$table->string('description');
|
||||
$table->json('properties')->nullable(); // Additional event data
|
||||
$table->string('ip_address')->nullable();
|
||||
$table->string('user_agent')->nullable();
|
||||
$table->morphs('subject'); // Polymorphic relation to any model
|
||||
$table->timestamps();
|
||||
|
||||
// Indexes for querying
|
||||
$table->index(['user_id', 'created_at']);
|
||||
$table->index(['event']);
|
||||
// Note: morphs() already creates an index for subject_type and subject_id
|
||||
$table->index(['created_at']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('activity_logs');
|
||||
}
|
||||
};
|
||||
20
database/seeders/DatabaseSeeder.php
Normal file
20
database/seeders/DatabaseSeeder.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$this->call([
|
||||
UserSeeder::class,
|
||||
ResumeSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
242
database/seeders/ResumeSeeder.php
Normal file
242
database/seeders/ResumeSeeder.php
Normal file
@@ -0,0 +1,242 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Resume;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ResumeSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$admin = User::where('email', 'david@valera-melendez.de')->first();
|
||||
$demo = User::where('email', 'demo@example.com')->first();
|
||||
|
||||
if ($admin) {
|
||||
// Create admin's professional resume
|
||||
Resume::create([
|
||||
'user_id' => $admin->id,
|
||||
'title' => 'Senior Full-Stack Developer Resume',
|
||||
'description' => 'Professional resume showcasing expertise in Laravel, Angular, and enterprise software development.',
|
||||
'template' => 'executive',
|
||||
'content' => [
|
||||
'personal_info' => [
|
||||
'full_name' => 'David Valera Melendez',
|
||||
'title' => 'Senior Full-Stack Developer',
|
||||
'email' => 'david@valera-melendez.de',
|
||||
'phone' => '+49 123 456 7890',
|
||||
'location' => 'Germany',
|
||||
'website' => 'https://valera-melendez.de',
|
||||
'linkedin' => 'https://linkedin.com/in/david-valera-melendez',
|
||||
'github' => 'https://github.com/davidvalera',
|
||||
],
|
||||
'summary' => 'Experienced Senior Full-Stack Developer with 8+ years of expertise in enterprise web applications. Specialized in Laravel, Angular, and modern development practices. Proven track record of delivering scalable solutions for international clients.',
|
||||
'experience' => [
|
||||
[
|
||||
'company' => 'Tech Solutions GmbH',
|
||||
'position' => 'Senior Full-Stack Developer',
|
||||
'location' => 'Berlin, Germany',
|
||||
'start_date' => '2020-01-01',
|
||||
'end_date' => null,
|
||||
'current' => true,
|
||||
'description' => 'Lead development of enterprise web applications using Laravel, Angular, and microservices architecture. Mentor junior developers and establish best practices.',
|
||||
'achievements' => [
|
||||
'Architected and developed 5+ enterprise applications serving 100K+ users',
|
||||
'Reduced application load time by 60% through optimization techniques',
|
||||
'Led team of 6 developers on critical client projects',
|
||||
'Implemented CI/CD pipelines reducing deployment time by 80%'
|
||||
]
|
||||
],
|
||||
[
|
||||
'company' => 'Digital Innovation Ltd',
|
||||
'position' => 'Full-Stack Developer',
|
||||
'location' => 'Hamburg, Germany',
|
||||
'start_date' => '2018-06-01',
|
||||
'end_date' => '2019-12-31',
|
||||
'current' => false,
|
||||
'description' => 'Developed responsive web applications and REST APIs for various clients in e-commerce and fintech sectors.',
|
||||
'achievements' => [
|
||||
'Built e-commerce platform handling €2M+ monthly transactions',
|
||||
'Developed fintech dashboard with real-time analytics',
|
||||
'Improved code quality by implementing automated testing'
|
||||
]
|
||||
]
|
||||
],
|
||||
'education' => [
|
||||
[
|
||||
'institution' => 'Technical University of Berlin',
|
||||
'degree' => 'Master of Science in Computer Science',
|
||||
'field' => 'Software Engineering',
|
||||
'start_date' => '2014-09-01',
|
||||
'end_date' => '2016-07-31',
|
||||
'gpa' => '1.2',
|
||||
'description' => 'Specialized in software architecture, distributed systems, and web technologies.'
|
||||
],
|
||||
[
|
||||
'institution' => 'University of Applied Sciences',
|
||||
'degree' => 'Bachelor of Science in Information Technology',
|
||||
'field' => 'Web Development',
|
||||
'start_date' => '2011-09-01',
|
||||
'end_date' => '2014-07-31',
|
||||
'gpa' => '1.4',
|
||||
'description' => 'Foundation in programming, databases, and web development technologies.'
|
||||
]
|
||||
],
|
||||
'skills' => [
|
||||
'Backend Development' => ['Laravel', 'PHP', 'Node.js', 'Python', 'REST APIs', 'GraphQL'],
|
||||
'Frontend Development' => ['Angular', 'TypeScript', 'JavaScript', 'HTML5', 'CSS3', 'Bootstrap', 'Sass'],
|
||||
'Databases' => ['MySQL', 'PostgreSQL', 'MongoDB', 'Redis'],
|
||||
'DevOps & Tools' => ['Docker', 'AWS', 'Git', 'CI/CD', 'Linux', 'Nginx'],
|
||||
'Methodologies' => ['Agile', 'Scrum', 'TDD', 'Clean Code', 'Design Patterns']
|
||||
],
|
||||
'projects' => [
|
||||
[
|
||||
'name' => 'Enterprise Resume Builder',
|
||||
'description' => 'Professional resume builder application with Laravel backend and Angular frontend.',
|
||||
'technologies' => ['Laravel', 'Angular', 'Bootstrap', 'MySQL'],
|
||||
'url' => 'https://resume.valera-melendez.de',
|
||||
'achievements' => [
|
||||
'Built scalable architecture supporting 10K+ users',
|
||||
'Implemented real-time collaboration features',
|
||||
'Created PDF generation with custom templates'
|
||||
]
|
||||
],
|
||||
[
|
||||
'name' => 'E-commerce Platform',
|
||||
'description' => 'Full-featured e-commerce solution with inventory management and payment processing.',
|
||||
'technologies' => ['Laravel', 'Vue.js', 'PostgreSQL', 'Stripe'],
|
||||
'achievements' => [
|
||||
'Processed €5M+ in transactions',
|
||||
'Integrated multiple payment gateways',
|
||||
'Built admin dashboard with analytics'
|
||||
]
|
||||
]
|
||||
],
|
||||
'certifications' => [
|
||||
[
|
||||
'name' => 'AWS Certified Solutions Architect',
|
||||
'issuer' => 'Amazon Web Services',
|
||||
'date' => '2023-03-15',
|
||||
'credential_id' => 'AWS-SA-12345',
|
||||
'url' => 'https://aws.amazon.com/certification/'
|
||||
],
|
||||
[
|
||||
'name' => 'Laravel Certified Developer',
|
||||
'issuer' => 'Laravel',
|
||||
'date' => '2022-08-20',
|
||||
'credential_id' => 'LRV-DEV-67890'
|
||||
]
|
||||
],
|
||||
'languages' => [
|
||||
['language' => 'German', 'level' => 'Native'],
|
||||
['language' => 'English', 'level' => 'Fluent'],
|
||||
['language' => 'Spanish', 'level' => 'Intermediate'],
|
||||
]
|
||||
],
|
||||
'settings' => [
|
||||
'color_scheme' => 'blue',
|
||||
'font_family' => 'Arial',
|
||||
'font_size' => 11,
|
||||
'line_spacing' => 1.2,
|
||||
'margin' => 20,
|
||||
'show_photo' => false,
|
||||
'section_order' => ['summary', 'experience', 'education', 'skills', 'projects', 'certifications', 'languages']
|
||||
],
|
||||
'status' => 'published',
|
||||
'is_public' => true,
|
||||
'public_url' => 'david-valera-melendez-senior-developer',
|
||||
'published_at' => now(),
|
||||
'completion_percentage' => 100,
|
||||
'completion_sections' => [
|
||||
'personal_info' => true,
|
||||
'summary' => true,
|
||||
'experience' => true,
|
||||
'education' => true,
|
||||
'skills' => true,
|
||||
'projects' => true,
|
||||
'certifications' => true,
|
||||
'languages' => true
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
if ($demo) {
|
||||
// Create demo user's resume
|
||||
Resume::create([
|
||||
'user_id' => $demo->id,
|
||||
'title' => 'My Professional Resume',
|
||||
'description' => 'Demo resume for testing the application features.',
|
||||
'template' => 'modern',
|
||||
'content' => [
|
||||
'personal_info' => [
|
||||
'full_name' => 'Demo User',
|
||||
'title' => 'Software Developer',
|
||||
'email' => 'demo@example.com',
|
||||
'phone' => '+1 555 123 4567',
|
||||
'location' => 'New York, USA',
|
||||
],
|
||||
'summary' => 'Passionate software developer with experience in web development and modern frameworks.',
|
||||
'experience' => [
|
||||
[
|
||||
'company' => 'Example Corp',
|
||||
'position' => 'Junior Developer',
|
||||
'location' => 'New York, USA',
|
||||
'start_date' => '2022-01-01',
|
||||
'end_date' => null,
|
||||
'current' => true,
|
||||
'description' => 'Developing web applications and learning new technologies.',
|
||||
'achievements' => [
|
||||
'Built responsive web interfaces',
|
||||
'Collaborated with senior developers',
|
||||
'Participated in code reviews'
|
||||
]
|
||||
]
|
||||
],
|
||||
'education' => [
|
||||
[
|
||||
'institution' => 'State University',
|
||||
'degree' => 'Bachelor of Science',
|
||||
'field' => 'Computer Science',
|
||||
'start_date' => '2018-09-01',
|
||||
'end_date' => '2022-05-31',
|
||||
'gpa' => '3.8'
|
||||
]
|
||||
],
|
||||
'skills' => [
|
||||
'Programming' => ['JavaScript', 'Python', 'Java'],
|
||||
'Web Development' => ['HTML', 'CSS', 'React', 'Node.js'],
|
||||
'Tools' => ['Git', 'VS Code', 'Docker']
|
||||
]
|
||||
],
|
||||
'settings' => [
|
||||
'color_scheme' => 'green',
|
||||
'font_family' => 'Arial',
|
||||
'font_size' => 10,
|
||||
'section_order' => ['summary', 'experience', 'education', 'skills']
|
||||
],
|
||||
'status' => 'draft',
|
||||
'completion_percentage' => 75,
|
||||
'completion_sections' => [
|
||||
'personal_info' => true,
|
||||
'summary' => true,
|
||||
'experience' => true,
|
||||
'education' => true,
|
||||
'skills' => true
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
// Create additional test resumes
|
||||
$users = User::all();
|
||||
foreach ($users as $user) {
|
||||
if (!in_array($user->email, ['david@valera-melendez.de', 'demo@example.com'])) {
|
||||
Resume::factory()->create(['user_id' => $user->id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
66
database/seeders/UserSeeder.php
Normal file
66
database/seeders/UserSeeder.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class UserSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// Create admin user
|
||||
User::create([
|
||||
'first_name' => 'David',
|
||||
'last_name' => 'Valera Melendez',
|
||||
'email' => 'david@valera-melendez.de',
|
||||
'email_verified_at' => now(),
|
||||
'password' => Hash::make('password123'),
|
||||
'phone' => '+49 123 456 7890',
|
||||
'bio' => 'Senior Full-Stack Developer and Enterprise Software Architect specializing in Laravel, Angular, and modern web technologies.',
|
||||
'website' => 'https://valera-melendez.de',
|
||||
'linkedin' => 'https://linkedin.com/in/david-valera-melendez',
|
||||
'github' => 'https://github.com/davidvalera',
|
||||
'preferences' => [
|
||||
'theme' => 'professional',
|
||||
'language' => 'en',
|
||||
'notifications' => true,
|
||||
'marketing_emails' => false,
|
||||
],
|
||||
'newsletter_subscribed' => false,
|
||||
'status' => 'active',
|
||||
'locale' => 'en',
|
||||
'timezone' => 'Europe/Berlin',
|
||||
'profile_completed_at' => now(),
|
||||
]);
|
||||
|
||||
// Create demo user
|
||||
User::create([
|
||||
'first_name' => 'Demo',
|
||||
'last_name' => 'User',
|
||||
'email' => 'demo@example.com',
|
||||
'email_verified_at' => now(),
|
||||
'password' => Hash::make('demo123'),
|
||||
'bio' => 'Demo user for testing the resume builder application.',
|
||||
'preferences' => [
|
||||
'theme' => 'modern',
|
||||
'language' => 'en',
|
||||
'notifications' => true,
|
||||
'marketing_emails' => true,
|
||||
],
|
||||
'newsletter_subscribed' => true,
|
||||
'status' => 'active',
|
||||
'locale' => 'en',
|
||||
'timezone' => 'UTC',
|
||||
'profile_completed_at' => now(),
|
||||
]);
|
||||
|
||||
// Create additional test users
|
||||
User::factory(10)->create();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user