* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace Database\Factories; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; use InnoShop\Common\Models\Brand; /** * @extends Factory */ class BrandFactory extends Factory { protected $model = Brand::class; public function definition(): array { $name = fake()->company(); return [ 'name' => $name, 'slug' => Str::slug($name).'-'.Str::random(5), 'first' => strtoupper(substr($name, 0, 1)), 'logo' => '', 'position' => fake()->numberBetween(0, 100), 'active' => true, ]; } public function inactive(): static { return $this->state(fn (array $attributes) => [ 'active' => false, ]); } }