2020-06-29 12:28:09 +00:00
|
|
|
<?php
|
|
|
|
|
2020-06-30 08:09:31 +00:00
|
|
|
use App\User;
|
2020-06-29 12:28:09 +00:00
|
|
|
use Illuminate\Database\Seeder;
|
2020-06-30 08:55:58 +00:00
|
|
|
use Illuminate\Support\Facades\Log;
|
2020-06-29 12:28:09 +00:00
|
|
|
|
|
|
|
class UserSeeder extends Seeder
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the database seeds.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function run()
|
|
|
|
{
|
2020-06-30 08:09:31 +00:00
|
|
|
|
2020-06-30 08:55:58 +00:00
|
|
|
// try {
|
|
|
|
//
|
|
|
|
// } catch (Exception $e) {
|
|
|
|
// }
|
|
|
|
|
|
|
|
Log::debug("YEET");
|
|
|
|
|
2020-06-30 09:30:12 +00:00
|
|
|
|
2020-07-27 08:31:57 +00:00
|
|
|
/*if(User::where("name_first", "admin"))
|
2020-06-30 08:55:58 +00:00
|
|
|
{
|
|
|
|
return;
|
2020-07-27 08:31:57 +00:00
|
|
|
}*/
|
2020-06-30 08:09:31 +00:00
|
|
|
|
2020-06-30 09:30:12 +00:00
|
|
|
|
2020-06-30 08:55:58 +00:00
|
|
|
Log::debug("OPRET");
|
2020-06-29 12:28:09 +00:00
|
|
|
$user = new \App\User();
|
|
|
|
|
|
|
|
$user->name_first = "admin";
|
|
|
|
$user->name_last = "admin";
|
|
|
|
$user->email = "admin@admin.local";
|
|
|
|
$user->setPasswordAttribute("1234");
|
|
|
|
$user->phone = 12345678;
|
|
|
|
|
2020-06-30 08:09:31 +00:00
|
|
|
|
|
|
|
|
2020-06-29 12:28:09 +00:00
|
|
|
foreach (\Spatie\Permission\Models\Permission::all() as $permission) {
|
|
|
|
$user->givePermissionTo($permission);
|
|
|
|
}
|
|
|
|
|
|
|
|
$user->save();
|
|
|
|
}
|
|
|
|
}
|