1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Backpack\CRUD\Tests\Config\Database\Seeds; |
4
|
|
|
|
5
|
|
|
use Illuminate\Database\Seeder; |
6
|
|
|
use Illuminate\Support\Facades\DB; |
7
|
|
|
use Illuminate\Support\Str; |
8
|
|
|
|
9
|
|
|
class UsersTableSeeder extends Seeder |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* Run the database seeds. |
13
|
|
|
* |
14
|
|
|
* @return void |
15
|
|
|
*/ |
16
|
|
|
public function run() |
17
|
|
|
{ |
18
|
|
|
$faker = \Faker\Factory::create(); |
19
|
|
|
$now = \Carbon\Carbon::now(); |
20
|
|
|
|
21
|
|
|
DB::table('users')->insert([[ |
22
|
|
|
'id' => 1, |
23
|
|
|
'name' => $faker->name, |
24
|
|
|
'email' => $faker->safeEmail, |
25
|
|
|
'password' => bcrypt('secret'), |
26
|
|
|
'remember_token' => Str::random(10), |
27
|
|
|
'created_at' => $now, |
28
|
|
|
'updated_at' => $now, |
29
|
|
|
]]); |
30
|
|
|
|
31
|
|
|
DB::table('users')->insert([[ |
32
|
|
|
'id' => 2, |
33
|
|
|
'name' => $faker->name, |
34
|
|
|
'email' => $faker->safeEmail, |
35
|
|
|
'password' => bcrypt('secret'), |
36
|
|
|
'remember_token' => Str::random(10), |
37
|
|
|
'created_at' => $now, |
38
|
|
|
'updated_at' => $now, |
39
|
|
|
]]); |
40
|
|
|
|
41
|
|
|
DB::table('user_role')->insert([ |
42
|
|
|
'user_id' => 1, |
43
|
|
|
'role_id' => 1, |
44
|
|
|
]); |
45
|
|
|
|
46
|
|
|
DB::table('user_role')->insert([ |
47
|
|
|
'user_id' => 2, |
48
|
|
|
'role_id' => 1, |
49
|
|
|
]); |
50
|
|
|
DB::table('user_role')->insert([ |
51
|
|
|
'user_id' => 2, |
52
|
|
|
'role_id' => 2, |
53
|
|
|
]); |
54
|
|
|
|
55
|
|
|
DB::table('account_details')->insert([ |
56
|
|
|
'user_id' => 1, |
57
|
|
|
'nickname' => $faker->firstName(), |
58
|
|
|
'profile_picture' => $faker->imageUrl(), |
59
|
|
|
]); |
60
|
|
|
|
61
|
|
|
DB::table('addresses')->insert([ |
62
|
|
|
'account_details_id' => 1, |
63
|
|
|
'city' => $faker->city, |
64
|
|
|
'street' => $faker->streetName, |
65
|
|
|
'number' => $faker->randomDigitNotNull, |
66
|
|
|
]); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|