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