Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
AJAYSINGHBISHT12 committed Jul 10, 2023
1 parent f7fc049 commit 1415e03
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Modules\CodeTrek\Database\Seeders;

use Illuminate\Database\Seeder;
// use Illuminate\Database\Eloquent\Factories\Factory as EloquentFactory;
use Illuminate\Database\Eloquent\Model;
// use Modules\CodeTrek\Database\Factories\CodeTrekApplicantFactory;
use Modules\CodeTrek\Entities\CodeTrekApplicant;

class CodeTrekApplicantsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// Model::unguard();

CodeTrekApplicant::factory()->count(50)->create();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ public function run()
Model::unguard();

$this->call(CodeTrekPermissionTableSeeder::class);
$this->call(CodeTrekApplicantsTableSeeder::class);
}
}
37 changes: 37 additions & 0 deletions Modules/CodeTrek/Database/factories/CodeTrekApplicantFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Modules\CodeTrek\Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;
use Modules\CodeTrek\Entities\CodeTrekApplicant;

class CodeTrekApplicantFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = CodeTrekApplicant::class;

/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'first_name' => $this->faker->firstName,
'last_name' => $this->faker->lastName,
'email' => $this->faker->unique()->safeEmail,
'github_user_name' => $this->faker->userName,
'phone' => $this->faker->phoneNumber,
'status' => 'active',
'course' => $this->faker->randomElement(['Computer Science', 'Engineering', 'Mathematics']),
'start_date' => $this->faker->date(),
'graduation_year' => $this->faker->year,
'university' => $this->faker->company,
];
}
}
10 changes: 9 additions & 1 deletion Modules/CodeTrek/Entities/CodeTrekApplicant.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,29 @@
namespace Modules\CodeTrek\Entities;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Modules\Operations\Entities\OfficeLocation;
use Modules\CodeTrek\Database\Factories\CodeTrekApplicantFactory;
use Carbon\Carbon;
use Modules\User\Entities\User;

class CodeTrekApplicant extends Model
{
use SoftDeletes;
use SoftDeletes, HasFactory;
protected $guarded = [];

public function roundDetails()
{
return $this->hasMany(CodeTrekApplicantRoundDetail::class);
}

public static function factory()
{
return new CodeTrekApplicantFactory();
}


public function center()
{
return $this->belongsTo(OfficeLocation::class, 'center_id');
Expand Down

0 comments on commit 1415e03

Please sign in to comment.