Skip to content

Commit

Permalink
update seeders for L8
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremykenedy committed Sep 21, 2020
1 parent 5c84da5 commit 35851ca
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 19 deletions.
4 changes: 0 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@
}
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
Expand Down
6 changes: 5 additions & 1 deletion database/factories/ModelFactory.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

namespace Database\Factories;

use Faker\Generator as Faker;
use Illuminate\Support\Str;
use jeremykenedy\LaravelRoles\Models\Role;

/*
Expand All @@ -26,7 +30,7 @@
'password' => $password ?: $password = bcrypt('secret'),
'token' => str_random(64),
'activated' => true,
'remember_token' => str_random(10),
'remember_token' => Str::random(10),
'signup_ip_address' => $faker->ipv4,
'signup_confirmation_ip_address' => $faker->ipv4,
];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Database\Seeds;
namespace Database\Seeders;

use Illuminate\Database\Seeder;
use jeremykenedy\LaravelBlocker\App\Models\BlockedItem;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Database\Seeds;
namespace Database\Seeders;

use Illuminate\Database\Seeder;
use jeremykenedy\LaravelBlocker\App\Models\BlockedType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;

class ConnectRelationshipsSeeder extends Seeder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Seeder;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;

class PermissionsTableSeeder extends Seeder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;

class RolesTableSeeder extends Seeder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Database\Seeders;

use App\Models\Theme;
use Illuminate\Database\Seeder;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php

namespace Database\Seeders;

use App\Models\Profile;
use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
use jeremykenedy\LaravelRoles\Models\Role;

class UsersTableSeeder extends Seeder
Expand All @@ -14,7 +17,6 @@ class UsersTableSeeder extends Seeder
*/
public function run()
{
$faker = Faker\Factory::create();
$profile = new Profile();
$adminRole = Role::whereName('Admin')->first();
$userRole = Role::whereName('User')->first();
Expand All @@ -24,15 +26,15 @@ public function run()
$user = User::where('email', '=', $seededAdminEmail)->first();
if ($user === null) {
$user = User::create([
'name' => $faker->userName,
'first_name' => $faker->firstName,
'last_name' => $faker->lastName,
'name' => 'Admin',
'first_name' => 'Harry',
'last_name' => 'Potter',
'email' => $seededAdminEmail,
'password' => Hash::make('password'),
'token' => str_random(64),
'activated' => true,
'signup_confirmation_ip_address' => $faker->ipv4,
'admin_ip_address' => $faker->ipv4,
'signup_confirmation_ip_address' => '127.0.0.1',
'admin_ip_address' => '127.0.0.1',
]);

$user->profile()->save($profile);
Expand All @@ -44,15 +46,15 @@ public function run()
$user = User::where('email', '=', '[email protected]')->first();
if ($user === null) {
$user = User::create([
'name' => $faker->userName,
'first_name' => $faker->firstName,
'last_name' => $faker->lastName,
'name' => 'User',
'first_name' => 'Hermione',
'last_name' => 'Granger',
'email' => '[email protected]',
'password' => Hash::make('password'),
'token' => str_random(64),
'activated' => true,
'signup_ip_address' => $faker->ipv4,
'signup_confirmation_ip_address' => $faker->ipv4,
'signup_ip_address' => '127.0.0.1',
'signup_confirmation_ip_address' => '127.0.0.1',
]);

$user->profile()->save(new Profile());
Expand Down
2 changes: 1 addition & 1 deletion resources/views/welcome.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<a href="{{ route('register') }}" class="ml-4 text-sm text-gray-500 underline">Register</a>
@endif
@endif
<a href="{{ url('/terms') }}" class="text-sm text-gray-500 underline" style="margin-left: 5px;">Terms</a>
<a href="{{ url('/terms') }}" class="text-sm text-gray-500 underline ml-4">Terms</a>
</div>
@endif

Expand Down

0 comments on commit 35851ca

Please sign in to comment.