44 lines
957 B
PHP
44 lines
957 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\CustomerLogin;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class CustomerLoginFactory extends Factory
|
|
{
|
|
/**
|
|
* Keep in memory if factory produced more than one model
|
|
*
|
|
* @var boolean
|
|
*/
|
|
protected static $first = false;
|
|
|
|
/**
|
|
* The name of the factory's corresponding model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $model = CustomerLogin::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$bool = $this->faker->boolean;
|
|
// * Force first to be active.
|
|
if (!self::$first) {
|
|
self::$first = true;
|
|
$bool = false;
|
|
}
|
|
return [
|
|
'password' => 'testPassword',
|
|
'last_connection' => Carbon::now(),
|
|
'status' => $bool
|
|
];
|
|
}
|
|
}
|