/ database / factories / TaskCommentFactory.php
TaskCommentFactory.php
 1  <?php
 2  
 3  namespace Database\Factories;
 4  
 5  use App\Models\Task;
 6  use App\Models\TaskComment;
 7  use App\Models\User;
 8  use Illuminate\Database\Eloquent\Factories\Factory;
 9  
10  class TaskCommentFactory extends Factory
11  {
12      /**
13       * The name of the factory's corresponding model.
14       *
15       * @var string
16       */
17      protected $model = TaskComment::class;
18  
19      /**
20       * Define the model's default state.
21       *
22       * @return array
23       */
24      public function definition()
25      {
26          return [
27              'comment' => $this->faker->sentence(),
28              'task_id' => Task::inRandomOrder()->first()->id,
29              'user_id' => User::first()->id,
30          ];
31      }
32  }