feat(website-type): add footer logo support in WebsiteType model, controller, and resource; update seeder and tests
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('website_type', function (Blueprint $table): void {
|
||||
$table->unsignedBigInteger('footer_logo')->nullable()->after('site_logo');
|
||||
|
||||
$table->foreign('footer_logo')
|
||||
->references('id')
|
||||
->on('attachments')
|
||||
->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('website_type', function (Blueprint $table): void {
|
||||
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
|
||||
$table->dropForeign(['footer_logo']);
|
||||
}
|
||||
|
||||
$table->dropColumn('footer_logo');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -33,6 +33,7 @@ class WebsiteTypeSeeder extends Seeder
|
||||
'dominio' => 'localhost',
|
||||
...self::PRESENTATION,
|
||||
'site_logo' => $this->onTicketLogo(),
|
||||
'footer_logo' => $this->onTicketFooterLogo(),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -64,6 +65,7 @@ class WebsiteTypeSeeder extends Seeder
|
||||
'dominio' => 'onticket.localhost',
|
||||
...self::PRESENTATION,
|
||||
'site_logo' => $this->onTicketLogo(),
|
||||
'footer_logo' => $this->onTicketFooterLogo(),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -115,7 +117,7 @@ class WebsiteTypeSeeder extends Seeder
|
||||
|
||||
private function onTicketLogo(): UploadedFile
|
||||
{
|
||||
$path = public_path('images/website_types/shopit_logo.png');
|
||||
$path = public_path('images/website_types/onticket_logo.png');
|
||||
|
||||
if (! file_exists($path)) {
|
||||
throw new RuntimeException("OnTicket logo not found at path: {$path}");
|
||||
@@ -129,4 +131,21 @@ class WebsiteTypeSeeder extends Seeder
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
private function onTicketFooterLogo(): UploadedFile
|
||||
{
|
||||
$path = public_path('images/website_types/onticket_footer_logo.png');
|
||||
|
||||
if (! file_exists($path)) {
|
||||
throw new RuntimeException("OnTicket footer logo not found at path: {$path}");
|
||||
}
|
||||
|
||||
return new UploadedFile(
|
||||
$path,
|
||||
'onticket_footer_logo.png',
|
||||
'image/png',
|
||||
null,
|
||||
true,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user