/
UsersTableSeeder.php
76 lines (70 loc) · 2.28 KB
/
UsersTableSeeder.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* NOTICE OF LICENSE.
*
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D Community Edition
*
* @author HDVinnie <hdinnovations@protonmail.com>
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
*/
namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Str;
class UsersTableSeeder extends Seeder
{
private $users;
public function __construct()
{
$this->users = $this->getUsers();
}
/**
* Auto generated seed file.
*
* @return void
*/
public function run()
{
foreach ($this->users as $user) {
User::updateOrCreate($user);
}
}
private function getUsers()
{
return [
[
'username' => 'System',
'email' => config('unit3d.default-owner-email'),
'group_id' => 9,
'password' => \Hash::make(config('unit3d.default-owner-password')),
'passkey' => md5(random_bytes(60)),
'rsskey' => md5(random_bytes(60)),
'api_token' => Str::random(100),
'active' => 1,
],
[
'username' => 'Bot',
'email' => config('unit3d.default-owner-email'),
'group_id' => 9,
'password' => \Hash::make(config('unit3d.default-owner-password')),
'passkey' => md5(random_bytes(60)),
'rsskey' => md5(random_bytes(60)),
'api_token' => Str::random(100),
'active' => 1,
],
[
'username' => config('unit3d.owner-username'),
'email' => config('unit3d.default-owner-email'),
'group_id' => 10,
'password' => \Hash::make(config('unit3d.default-owner-password')),
'passkey' => md5(random_bytes(60)),
'rsskey' => md5(random_bytes(60)),
'api_token' => Str::random(100),
'active' => 1,
],
];
}
}