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,29 @@
<?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('about_us', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->string('filename')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('about_us');
}
};

View File

@@ -0,0 +1,49 @@
<?php
namespace Modules\AboutUs\database\seeders;
use Illuminate\Support\Str;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Storage;
use Modules\AboutUs\app\Models\AboutUs;
class AboutUsDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// $this->call([]);
$aboutUs = new AboutUs();
$aboutUs->title = 'about us';
$aboutUs->save();
// Add image to the created banner
$this->uploadImageForBanner('test_video.mp4.', $aboutUs);
}
private function uploadImageForBanner(string $imageFileName, $cmsbanner)
{
$seederDirPath = 'aboutUs/';
// Generate a unique filename for the new image
$newFileName = Str::uuid() . '.mp4';
// Storage path for the new image
$storagePath = '/aboutUs/' . $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->filename = $newFileName;
$cmsbanner->save();
}
}
}