Skip to content

Commit

Permalink
feat: create factory for draft.
Browse files Browse the repository at this point in the history
  • Loading branch information
NishaSharma14 committed Nov 18, 2022
1 parent 2710bd1 commit 107189e
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions database/factories/DraftFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace Database\Factories;

use App\Models\User;
use App\Models\Team;
use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Draft>
*/
class DraftFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition()
{
$user = User::factory()->withPersonalTeam()->create();
$key = Str::uuid();
$environment = env('APP_ENV', 'local');
$path = $environment.'/'.$user->id.'/drafts/'.$key;

return [
'name' => Str::random(),
'slug' => Str::random(),
'description' => $this->faker->text(),
'relative_url' => "/".$this->faker->uuid(),
'path' => $path,
'key' => Str::uuid(),
'is_deleted' => "False",
'owner_id' => $user->id,
'team_id' => Team::factory(),
'info' => "{}",
'settings' => "{}",
];
}
}

0 comments on commit 107189e

Please # to comment.