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,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
// Schema::create('social_shares', function (Blueprint $table) {
// $table->id();
// $table->uuid();
// $table->unsignedBigInteger('team_member_id');
// $table->string('name');
// $table->string('link');
// $table->softDeletes();
// $table->timestamps();
// $table->foreign('team_member_id')->references('id')->on('team_members');
// });
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('social_shares');
}
};

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('team_members', function (Blueprint $table) {
$table->id();
$table->uuid();
$table->string('name');
$table->string('designation');
$table->text('detail')->nullable();
$table->string('image')->nullable();
$table->string('image_path')->nullable();
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('team_members');
}
};

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('team_members', function (Blueprint $table) {
$table->unsignedSmallInteger('group_id')->after('name');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('team_members', function (Blueprint $table) {
$table->dropColumn('group_id');
});
}
};

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();
}
}
}