clrghouz/database/factories/DomainFactory.php

53 lines
894 B
PHP

<?php
namespace Database\Factories;
use App\Models\Domain;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class DomainFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Domain::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->name(),
'dnsdomain' => $this->faker->unique()->safeEmail(),
'notes' => $this->faker->text(),
'homepage' => $this->faker->text(),
'active' => FALSE,
'public' => FALSE,
];
}
public function active()
{
return $this->state(function (array $attributes) {
return [
'active' => TRUE,
];
});
}
public function public()
{
return $this->state(function (array $attributes) {
return [
'public' => TRUE,
];
});
}
}