xref: /webtrees/app/Schema/SeedUserTable.php (revision 8fcd0d32e56ee262912bbdb593202cfd1cbc1615)
1c9beb871SGreg Roach<?php
2c9beb871SGreg Roach/**
3c9beb871SGreg Roach * webtrees: online genealogy
4*8fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team
5c9beb871SGreg Roach * This program is free software: you can redistribute it and/or modify
6c9beb871SGreg Roach * it under the terms of the GNU General Public License as published by
7c9beb871SGreg Roach * the Free Software Foundation, either version 3 of the License, or
8c9beb871SGreg Roach * (at your option) any later version.
9c9beb871SGreg Roach * This program is distributed in the hope that it will be useful,
10c9beb871SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
11c9beb871SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12c9beb871SGreg Roach * GNU General Public License for more details.
13c9beb871SGreg Roach * You should have received a copy of the GNU General Public License
14c9beb871SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
15c9beb871SGreg Roach */
16c9beb871SGreg Roachdeclare(strict_types=1);
17c9beb871SGreg Roach
18c9beb871SGreg Roachnamespace Fisharebest\Webtrees\Schema;
19c9beb871SGreg Roach
20c9beb871SGreg Roachuse Illuminate\Database\Capsule\Manager as DB;
21c9beb871SGreg Roach
22c9beb871SGreg Roach/**
23c9beb871SGreg Roach * Populate the user table
24c9beb871SGreg Roach */
25c9beb871SGreg Roachclass SeedUserTable implements SeedInterface
26c9beb871SGreg Roach{
27c9beb871SGreg Roach    /**
28c9beb871SGreg Roach     *  Run the seeder.
29c9beb871SGreg Roach     *
30c9beb871SGreg Roach     * @return void
31c9beb871SGreg Roach     */
32c9beb871SGreg Roach    public function run(): void
33c9beb871SGreg Roach    {
34c9beb871SGreg Roach        // Add a "default" user, to store default settings
35c9beb871SGreg Roach        DB::table('user')->updateOrInsert([
36c9beb871SGreg Roach            'user_id'   => -1,
37c9beb871SGreg Roach        ], [
38c9beb871SGreg Roach            'user_name' => 'DEFAULT_USER',
39c9beb871SGreg Roach            'real_name' => 'DEFAULT_USER',
40c9beb871SGreg Roach            'email'     => 'DEFAULT_USER',
41c9beb871SGreg Roach            'password'  => 'DEFAULT_USER',
42c9beb871SGreg Roach        ]);
43c9beb871SGreg Roach    }
44c9beb871SGreg Roach}
45