firstcommit

This commit is contained in:
2025-08-17 16:23:14 +05:45
commit 76bf4c0a18
2648 changed files with 362795 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
<?php
namespace Modules\TeamMember\database\seeders;
use Illuminate\Support\Str;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Storage;
use Modules\TeamMember\app\Models\TeamMember;
use Modules\TeamMember\app\Models\SocialShare;
class TeamMemberDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$teamMembers = [
[
'name' => 'Dr. Biken Shrestha',
'group_id' => '1',
'designation' => '(NMC-6766)',
'detail' => 'Consultant Orthodontics and Dentofacial Orthopedics
BDS, MDS, PhD',
'image' => 't1.jpg'
],
[
'name' => 'Dr. Sanjay Ranjit',
'group_id' => '1',
'designation' => '(NMC-13464)',
'detail' => 'Consultant Dentistry and Endodontics
MDS, AIIMS New Delhi',
'image' => 't2.jpg'
],
[
'name' => 'Dr. Padma Malla',
'group_id' => '2',
'designation' => '(NMC-7163)',
'detail' => 'Senior Consultant Dermatologist and Venerologist, LASER /Aesthetic Specialist
MBBS, MD',
'image' => 't3.jpg'
],
[
'name' => 'Dr. Deepak Gautam',
'group_id' => '3',
'designation' => '(NMC-8969)',
'detail' => 'Consultant Joint Replacement and Orthopedics
MBBS, MS Ortho, AIIMS , New Delhi',
'image' => 't4.jpg'
]
];
foreach ($teamMembers as $teamMemberData) {
$teamMember = TeamMember::create([
'uuid' => Str::uuid(),
'name' => $teamMemberData['name'],
'group_id' => $teamMemberData['group_id'],
'designation' => $teamMemberData['designation'],
'detail' => $teamMemberData['detail']
]);
// Add image to the created banner
$this->uploadImageForBanner($teamMemberData['image'], $teamMember);
}
}
private function uploadImageForBanner(string $imageFileName, $cmsbanner)
{
$seederDirPath = 'teamMembers/';
// Generate a unique filename for the new image
$newFileName = Str::uuid() . '.jpg';
// Storage path for the new image
$storagePath = '/teamMembers/' . $newFileName;
// Check if the image exists in the seeder_disk
if (Storage::disk('seeder_disk')->exists($seederDirPath . $imageFileName)) {
// Copy the image from seeder to public
$fileContents = Storage::disk('seeder_disk')->get($seederDirPath . $imageFileName);
Storage::disk('public_uploads')->put($storagePath, $fileContents);
$cmsbanner->image = $newFileName;
$cmsbanner->image_path = $storagePath;
$cmsbanner->save();
}
}
}