36 lines
809 B
PHP
36 lines
809 B
PHP
<?php
|
|
|
|
use Illuminate\Database\Seeder;
|
|
use App\User;
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
|
class UserSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
$users = [
|
|
'alex' => 'Alex Thomassen',
|
|
'martin' => 'Martin Onsrud',
|
|
'stian' => 'Stian Larsen',
|
|
'oyvind' => 'Øyvind Finsrud',
|
|
];
|
|
|
|
foreach ($users as $username => $name)
|
|
{
|
|
$user = new User;
|
|
$user->username = $username;
|
|
$user->name = $name;
|
|
$user->email = $username . '@example.com';
|
|
$user->password = Hash::make('Kaffekopp123');
|
|
$user->admin = $username === 'alex' ? true : false;
|
|
|
|
$user->save();
|
|
}
|
|
}
|
|
}
|