Added userpics from thispersondoesnotexist.com
Signed-off-by: snipe <snipe@snipe.net>
|
@ -36,8 +36,8 @@ class AssetModelSeeder extends Seeder
|
|||
AssetModel::factory()->count(1)->tab3Model()->create(); // 14
|
||||
|
||||
// Phones
|
||||
AssetModel::factory()->count(1)->iphone6sModel()->create(); // 15
|
||||
AssetModel::factory()->count(1)->iphone7Model()->create(); // 16
|
||||
AssetModel::factory()->count(1)->iphone11Model()->create(); // 15
|
||||
AssetModel::factory()->count(1)->iphone12Model()->create(); // 16
|
||||
|
||||
// Displays
|
||||
AssetModel::factory()->count(1)->ultrafine()->create(); // 17
|
||||
|
|
|
@ -4,6 +4,8 @@ namespace Database\Seeders;
|
|||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UserSeeder extends Seeder
|
||||
{
|
||||
|
@ -20,5 +22,43 @@ class UserSeeder extends Seeder
|
|||
User::factory()->count(3)->superuser()->create();
|
||||
User::factory()->count(3)->admin()->create();
|
||||
User::factory()->count(50)->viewAssets()->create();
|
||||
|
||||
$src = public_path('/img/demo/avatars/');
|
||||
$dst = 'avatars'.'/';
|
||||
$del_files = Storage::files($dst);
|
||||
|
||||
foreach ($del_files as $del_file) { // iterate files
|
||||
$file_to_delete = str_replace($src, '', $del_file);
|
||||
Log::debug('Deleting: '.$file_to_delete);
|
||||
try {
|
||||
Storage::disk('public')->delete($dst.$del_file);
|
||||
} catch (\Exception $e) {
|
||||
Log::debug($e);
|
||||
}
|
||||
}
|
||||
|
||||
$add_files = glob($src.'/*.*');
|
||||
foreach ($add_files as $add_file) {
|
||||
$file_to_copy = str_replace($src, '', $add_file);
|
||||
Log::debug('Copying: '.$file_to_copy);
|
||||
try {
|
||||
Storage::disk('public')->put($dst.$file_to_copy, file_get_contents($src.$file_to_copy));
|
||||
} catch (\Exception $e) {
|
||||
Log::debug($e);
|
||||
}
|
||||
}
|
||||
|
||||
$users = User::orderBy('id', 'desc')->take(20)->get();
|
||||
$file_number = 1;
|
||||
|
||||
foreach ($users as $user) {
|
||||
|
||||
$user->avatar = $file_number.'.jpg';
|
||||
$user->save();
|
||||
$file_number++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
BIN
public/img/demo/avatars/1.jpg
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
public/img/demo/avatars/10.jpg
Normal file
After Width: | Height: | Size: 55 KiB |
BIN
public/img/demo/avatars/11.jpg
Normal file
After Width: | Height: | Size: 63 KiB |
BIN
public/img/demo/avatars/12.jpg
Normal file
After Width: | Height: | Size: 66 KiB |
BIN
public/img/demo/avatars/13.jpg
Normal file
After Width: | Height: | Size: 55 KiB |
BIN
public/img/demo/avatars/14.jpg
Normal file
After Width: | Height: | Size: 65 KiB |
BIN
public/img/demo/avatars/15.jpg
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
public/img/demo/avatars/16.jpg
Normal file
After Width: | Height: | Size: 55 KiB |
BIN
public/img/demo/avatars/17.jpg
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
public/img/demo/avatars/18.jpg
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
public/img/demo/avatars/19.jpg
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
public/img/demo/avatars/2.jpg
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
public/img/demo/avatars/20.jpg
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
public/img/demo/avatars/3.jpg
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
public/img/demo/avatars/4.jpg
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
public/img/demo/avatars/5.jpg
Normal file
After Width: | Height: | Size: 465 KiB |
BIN
public/img/demo/avatars/6.jpg
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
public/img/demo/avatars/7.jpg
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
public/img/demo/avatars/8.jpg
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
public/img/demo/avatars/9.jpg
Normal file
After Width: | Height: | Size: 62 KiB |