Fixed UserSeeder.php.

This commit is contained in:
Sebastian Davaris 2020-06-30 10:09:31 +02:00
parent 2409fec66e
commit 7f91e76d90
2 changed files with 11 additions and 1 deletions

View File

@ -25,7 +25,7 @@ class ResourceController extends Controller
*/
public function index()
{
//
}
/**

View File

@ -1,5 +1,6 @@
<?php
use App\User;
use Illuminate\Database\Seeder;
class UserSeeder extends Seeder
@ -11,6 +12,13 @@ class UserSeeder extends Seeder
*/
public function run()
{
try {
if(User::findByName("admin"))
return;
} catch (Exception $e) {
}
$user = new \App\User();
$user->name_first = "admin";
@ -19,6 +27,8 @@ class UserSeeder extends Seeder
$user->setPasswordAttribute("1234");
$user->phone = 12345678;
foreach (\Spatie\Permission\Models\Permission::all() as $permission) {
$user->givePermissionTo($permission);
}