akaunting/database/factories/User.php

66 lines
1.5 KiB
PHP
Raw Permalink Normal View History

2019-11-22 14:35:46 +00:00
<?php
2020-10-14 14:07:59 +00:00
namespace Database\Factories;
use App\Abstracts\Factory;
use App\Models\Auth\User as Model;
2019-11-22 14:35:46 +00:00
use Illuminate\Support\Str;
2020-10-14 14:07:59 +00:00
class User extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Model::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$password = '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'; // password
2019-11-22 14:35:46 +00:00
2020-10-14 14:07:59 +00:00
return [
'name' => $this->faker->name,
2022-06-01 07:15:55 +00:00
'email' => $this->faker->freeEmail,
2020-10-14 14:07:59 +00:00
'password' => $password,
'password_confirmation' => $password,
'remember_token' => Str::random(10),
'locale' => 'en-GB',
'companies' => ['1'],
2022-06-01 07:15:55 +00:00
'roles' => '1',
2020-10-14 14:07:59 +00:00
'enabled' => $this->faker->boolean ? 1 : 0,
2022-12-16 14:40:49 +00:00
'landing_page' => 'dashboard',
2021-09-09 21:31:39 +00:00
'created_from' => 'core::factory',
2020-10-14 14:07:59 +00:00
];
}
2020-01-06 22:28:05 +00:00
2020-10-14 14:07:59 +00:00
/**
* Indicate that the model is enabled.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function enabled()
{
2020-10-14 21:08:41 +00:00
return $this->state([
'enabled' => 1,
]);
2020-10-14 14:07:59 +00:00
}
2020-01-06 22:28:05 +00:00
2020-10-14 14:07:59 +00:00
/**
* Indicate that the model is disabled.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function disabled()
{
2020-10-14 21:08:41 +00:00
return $this->state([
'enabled' => 0,
]);
2020-10-14 14:07:59 +00:00
}
}