-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseed
33 lines (25 loc) · 832 Bytes
/
seed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env php
<?php
use App\Models\Item;
use App\Models\User;
use Core\App;
require_once __DIR__ . '/vendor/autoload.php';
$config = require __DIR__ . '/config.php';
$app = new App(__DIR__, $config);
$user = User::query()->where('email', 'mdaalvand@gmail.com')->first();
if (!$user) {
$user = User::create([
'first_name' => 'Mehdi',
'last_name' => 'daalvand',
'email' => 'mdaalvand@gmail.com',
'password' => password_hash('password', PASSWORD_DEFAULT),
]);
}
for ($i = 1; $i <= 100; $i++) {
$items = Item::create([
'title' => generate_random_string(20),
"description" => generate_random_string(100),
"image" => "https://fakeimg.pl/350x200/ff0000,128/000,255",
"price" => random_int(1, 1000) * 1000,
]);
}