create PM v0.5
This commit is contained in:
parent
9b47296cea
commit
d2ba22c0cf
25 changed files with 2155 additions and 72 deletions
33
database/factories/PressReleaseAttachmentFactory.php
Normal file
33
database/factories/PressReleaseAttachmentFactory.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\PressRelease;
|
||||
use App\Models\PressReleaseAttachment;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<PressReleaseAttachment>
|
||||
*/
|
||||
class PressReleaseAttachmentFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$name = $this->faker->slug(2).'.pdf';
|
||||
|
||||
return [
|
||||
'press_release_id' => PressRelease::factory(),
|
||||
'disk' => 'public',
|
||||
'path' => 'press-release-attachments/dummy/'.$name,
|
||||
'original_name' => $name,
|
||||
'mime' => 'application/pdf',
|
||||
'size' => $this->faker->numberBetween(50_000, 5_000_000),
|
||||
'title' => $this->faker->optional()->sentence(3),
|
||||
'description' => $this->faker->optional()->sentence(),
|
||||
'sort_order' => 0,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?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('companies', function (Blueprint $table) {
|
||||
$table->text('boilerplate')->nullable()->after('website');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('companies', function (Blueprint $table) {
|
||||
$table->dropColumn('boilerplate');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?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('press_releases', function (Blueprint $table) {
|
||||
$table->string('subtitle', 255)->nullable()->after('title');
|
||||
$table->text('boilerplate_override')->nullable()->after('text');
|
||||
$table->timestamp('scheduled_at')->nullable()->after('published_at');
|
||||
$table->timestamp('embargo_at')->nullable()->after('scheduled_at');
|
||||
|
||||
$table->index('scheduled_at', 'press_releases_scheduled_at_idx');
|
||||
$table->index('embargo_at', 'press_releases_embargo_at_idx');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('press_releases', function (Blueprint $table) {
|
||||
$table->dropIndex('press_releases_scheduled_at_idx');
|
||||
$table->dropIndex('press_releases_embargo_at_idx');
|
||||
$table->dropColumn(['subtitle', 'boilerplate_override', 'scheduled_at', 'embargo_at']);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
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::create('press_release_attachments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('press_release_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('disk', 30)->default('public');
|
||||
$table->string('path', 512);
|
||||
$table->string('original_name', 255);
|
||||
$table->string('mime', 100)->nullable();
|
||||
$table->unsignedBigInteger('size')->nullable();
|
||||
$table->string('title', 120)->nullable();
|
||||
$table->string('description', 500)->nullable();
|
||||
$table->unsignedInteger('sort_order')->default(0);
|
||||
$table->enum('legacy_portal', [
|
||||
Portal::Presseecho->value,
|
||||
Portal::Businessportal24->value,
|
||||
])->nullable();
|
||||
$table->unsignedBigInteger('legacy_id')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unique(['legacy_portal', 'legacy_id'], 'press_release_attachments_legacy_portal_legacy_id_unique');
|
||||
$table->index(['press_release_id', 'sort_order'], 'press_release_attachments_release_sort_idx');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('press_release_attachments');
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue