mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 06:20:21 +00:00
43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Client;
|
|
use App\Models\Project;
|
|
use App\Models\Team;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\MasterTask>
|
|
*/
|
|
class MasterTaskFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition()
|
|
{
|
|
// if (Project::all()->count() === 0) {
|
|
// $project = Project::factory()->create();
|
|
// } else {
|
|
// $project = Project::all()->random();
|
|
// }
|
|
|
|
$project = Project::all()->random();
|
|
|
|
$team = Team::all()->random();
|
|
|
|
return [
|
|
'project_id' => $project->id,
|
|
'team_id' => $team->id,
|
|
'title' => 'Master task ' . fake()->words(2, true),
|
|
'estimated_time' => fake()->numberBetween(20,100),
|
|
'tracked_time' => fake()->numberBetween(4,20),
|
|
'deadline' => fake()->date(),
|
|
'is_finished' => 0,
|
|
];
|
|
}
|
|
}
|