mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-14 07:27:47 +00:00
Color palette support in byos_laravel
This commit is contained in:
parent
c157dcf3b6
commit
9ee7bc1aac
7 changed files with 236 additions and 4 deletions
33
database/factories/PaletteFactory.php
Normal file
33
database/factories/PaletteFactory.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Palette;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Palette>
|
||||
*/
|
||||
class PaletteFactory extends Factory
|
||||
{
|
||||
protected $model = Palette::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$colors = collect(range(1, 6))
|
||||
->map(fn () => mb_strtoupper($this->faker->hexColor()))
|
||||
->map(fn (string $hex) => mb_ltrim($hex, '#'))
|
||||
->implode(',');
|
||||
|
||||
return [
|
||||
'name' => $this->faker->unique()->slug(),
|
||||
'description' => $this->faker->sentence(),
|
||||
'palette' => $colors,
|
||||
];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue