diff --git a/database/seeders/AssetModelSeeder.php b/database/seeders/AssetModelSeeder.php index e8816cc50..0652fbfb8 100755 --- a/database/seeders/AssetModelSeeder.php +++ b/database/seeders/AssetModelSeeder.php @@ -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 diff --git a/database/seeders/UserSeeder.php b/database/seeders/UserSeeder.php index c66f23265..107e8a337 100644 --- a/database/seeders/UserSeeder.php +++ b/database/seeders/UserSeeder.php @@ -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++; + } + + + } } diff --git a/public/img/demo/avatars/1.jpg b/public/img/demo/avatars/1.jpg new file mode 100644 index 000000000..78c59a67d Binary files /dev/null and b/public/img/demo/avatars/1.jpg differ diff --git a/public/img/demo/avatars/10.jpg b/public/img/demo/avatars/10.jpg new file mode 100644 index 000000000..95150c433 Binary files /dev/null and b/public/img/demo/avatars/10.jpg differ diff --git a/public/img/demo/avatars/11.jpg b/public/img/demo/avatars/11.jpg new file mode 100644 index 000000000..8aa9f8291 Binary files /dev/null and b/public/img/demo/avatars/11.jpg differ diff --git a/public/img/demo/avatars/12.jpg b/public/img/demo/avatars/12.jpg new file mode 100644 index 000000000..fc741d0fd Binary files /dev/null and b/public/img/demo/avatars/12.jpg differ diff --git a/public/img/demo/avatars/13.jpg b/public/img/demo/avatars/13.jpg new file mode 100644 index 000000000..bb3634c72 Binary files /dev/null and b/public/img/demo/avatars/13.jpg differ diff --git a/public/img/demo/avatars/14.jpg b/public/img/demo/avatars/14.jpg new file mode 100644 index 000000000..ee6f3bc70 Binary files /dev/null and b/public/img/demo/avatars/14.jpg differ diff --git a/public/img/demo/avatars/15.jpg b/public/img/demo/avatars/15.jpg new file mode 100644 index 000000000..e32542453 Binary files /dev/null and b/public/img/demo/avatars/15.jpg differ diff --git a/public/img/demo/avatars/16.jpg b/public/img/demo/avatars/16.jpg new file mode 100644 index 000000000..ca16a1ac5 Binary files /dev/null and b/public/img/demo/avatars/16.jpg differ diff --git a/public/img/demo/avatars/17.jpg b/public/img/demo/avatars/17.jpg new file mode 100644 index 000000000..5e1589053 Binary files /dev/null and b/public/img/demo/avatars/17.jpg differ diff --git a/public/img/demo/avatars/18.jpg b/public/img/demo/avatars/18.jpg new file mode 100644 index 000000000..34cd54853 Binary files /dev/null and b/public/img/demo/avatars/18.jpg differ diff --git a/public/img/demo/avatars/19.jpg b/public/img/demo/avatars/19.jpg new file mode 100644 index 000000000..0ad858b00 Binary files /dev/null and b/public/img/demo/avatars/19.jpg differ diff --git a/public/img/demo/avatars/2.jpg b/public/img/demo/avatars/2.jpg new file mode 100644 index 000000000..2e929c854 Binary files /dev/null and b/public/img/demo/avatars/2.jpg differ diff --git a/public/img/demo/avatars/20.jpg b/public/img/demo/avatars/20.jpg new file mode 100644 index 000000000..81d90c786 Binary files /dev/null and b/public/img/demo/avatars/20.jpg differ diff --git a/public/img/demo/avatars/3.jpg b/public/img/demo/avatars/3.jpg new file mode 100644 index 000000000..751b3dad8 Binary files /dev/null and b/public/img/demo/avatars/3.jpg differ diff --git a/public/img/demo/avatars/4.jpg b/public/img/demo/avatars/4.jpg new file mode 100644 index 000000000..aab81c559 Binary files /dev/null and b/public/img/demo/avatars/4.jpg differ diff --git a/public/img/demo/avatars/5.jpg b/public/img/demo/avatars/5.jpg new file mode 100644 index 000000000..118defa79 Binary files /dev/null and b/public/img/demo/avatars/5.jpg differ diff --git a/public/img/demo/avatars/6.jpg b/public/img/demo/avatars/6.jpg new file mode 100644 index 000000000..113a1d269 Binary files /dev/null and b/public/img/demo/avatars/6.jpg differ diff --git a/public/img/demo/avatars/7.jpg b/public/img/demo/avatars/7.jpg new file mode 100644 index 000000000..105153216 Binary files /dev/null and b/public/img/demo/avatars/7.jpg differ diff --git a/public/img/demo/avatars/8.jpg b/public/img/demo/avatars/8.jpg new file mode 100644 index 000000000..c9691ac94 Binary files /dev/null and b/public/img/demo/avatars/8.jpg differ diff --git a/public/img/demo/avatars/9.jpg b/public/img/demo/avatars/9.jpg new file mode 100644 index 000000000..544f7c907 Binary files /dev/null and b/public/img/demo/avatars/9.jpg differ