mirror of https://github.com/kcal-app/kcal.git
Use food words in factories
This commit is contained in:
parent
71ba007db9
commit
64cf3e274e
|
|
@ -4,7 +4,9 @@ namespace Database\Factories;
|
|||
|
||||
use App\Models\Food;
|
||||
|
||||
use Database\Support\Words;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class FoodFactory extends Factory
|
||||
{
|
||||
|
|
@ -20,7 +22,7 @@ class FoodFactory extends Factory
|
|||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->word,
|
||||
'name' => Words::randomWords(Arr::random(['n', 'an'])),
|
||||
'detail' => $this->faker->optional()->sentence(2),
|
||||
'brand' => $this->faker->optional()->word,
|
||||
'source' => $this->faker->optional()->url,
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@
|
|||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Recipe;
|
||||
use Database\Support\Words;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class RecipeFactory extends Factory
|
||||
|
|
@ -22,7 +24,7 @@ class RecipeFactory extends Factory
|
|||
{
|
||||
$description = htmlspecialchars($this->faker->realText(500));
|
||||
return [
|
||||
'name' => $this->faker->words($this->faker->numberBetween(1, 5), true),
|
||||
'name' => Words::randomWords(Arr::random(['npan', 'npn', 'anpn'])),
|
||||
'description' => "<p>{$description}</p>",
|
||||
'description_delta' => '{"ops":[{"insert":"' . $description . '\n"}]}"',
|
||||
'time_prep' => $this->faker->numberBetween(0, 20),
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Tag;
|
||||
use Database\Support\Words;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class TagFactory extends Factory
|
||||
|
|
@ -18,7 +19,7 @@ class TagFactory extends Factory
|
|||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->word,
|
||||
'name' => Words::randomWords('a'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue