Added userpics from thispersondoesnotexist.com

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2021-09-23 22:05:42 -07:00
parent d82490f4a6
commit 932c1364ee
22 changed files with 42 additions and 2 deletions

View file

@ -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

View file

@ -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++;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB