49 lines
853 B
PHP
49 lines
853 B
PHP
<?php
|
|
|
|
use App\User;
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
class UserSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
|
|
// try {
|
|
//
|
|
// } catch (Exception $e) {
|
|
// }
|
|
|
|
Log::debug("YEET");
|
|
|
|
|
|
/*if(User::where("name_first", "admin"))
|
|
{
|
|
return;
|
|
}*/
|
|
|
|
|
|
Log::debug("OPRET");
|
|
$user = new \App\User();
|
|
|
|
$user->name_first = "admin";
|
|
$user->name_last = "admin";
|
|
$user->email = "admin@admin.local";
|
|
$user->setPasswordAttribute("1234");
|
|
$user->phone = 12345678;
|
|
|
|
|
|
|
|
foreach (\Spatie\Permission\Models\Permission::all() as $permission) {
|
|
$user->givePermissionTo($permission);
|
|
}
|
|
|
|
$user->save();
|
|
}
|
|
}
|