diff --git a/app/Models/Audit/assessment.php b/app/Models/Audit/assessment.php index 0340c93..105fc46 100644 --- a/app/Models/Audit/assessment.php +++ b/app/Models/Audit/assessment.php @@ -12,11 +12,6 @@ class assessment extends Model protected $guarded = []; - public function jcp() - { - return $this->hasMany(jcp::class, 'assessment_id'); - - } public function enrolled() { diff --git a/app/Models/Audit/jcp.php b/app/Models/Audit/jcp.php index ede2a31..bbbc8d5 100644 --- a/app/Models/Audit/jcp.php +++ b/app/Models/Audit/jcp.php @@ -17,10 +17,6 @@ public function employee() return $this->belongsTo(User::class, 'user_id'); } - public function assessment() - { - return $this->belongsTo(assessment::class, 'assessment_id'); - } public function skills() { diff --git a/database/factories/Audit/jcpFactory.php b/database/factories/Audit/jcpFactory.php index 8474bef..33a038e 100644 --- a/database/factories/Audit/jcpFactory.php +++ b/database/factories/Audit/jcpFactory.php @@ -16,12 +16,10 @@ class jcpFactory extends Factory */ public function definition(): array { - $assessment_ids = \App\Models\Audit\assessment::select('id')->get(); $user_ids = \App\Models\User::select('id')->get(); return [ //This populates the jcp model fields - 'assessment_id' => $this->faker->randomElement($assessment_ids), 'user_id' => $this->faker->unique()->randomElement($user_ids), 'position_title' => $this->faker->jobTitle(), 'job_grade' => $this->faker->numerify('B-#'), diff --git a/database/migrations/2024_03_22_094647_create_jcps_table.php b/database/migrations/2024_03_22_094647_create_jcps_table.php index d8a1c1a..f72dc3e 100644 --- a/database/migrations/2024_03_22_094647_create_jcps_table.php +++ b/database/migrations/2024_03_22_094647_create_jcps_table.php @@ -13,7 +13,6 @@ public function up(): void { Schema::create('jcps', function (Blueprint $table) { $table->id(); - $table->foreignId('assessment_id')->constrained()->cascadeOnDelete(); $table->foreignId('user_id')->constrained()->cascadeOnDelete(); $table->string('position_title'); @@ -23,7 +22,6 @@ public function up(): void $table->integer('is_active')->default(1); // Add a unique constraint - $table->unique(['user_id', 'assessment_id']); $table->timestamps(); });