Skip to content

Commit aaa7b56

Browse files
authored
Merge pull request #6969 from ProcessMaker/feature/FOUR-16549
FOUR-16549: Adding a new table process_slideshow
2 parents 0ab37ab + cfaec97 commit aaa7b56

2 files changed

Lines changed: 46 additions & 5 deletions

File tree

‎ProcessMaker/Models/Media.php‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,17 @@ public function saveProcessMedia(Process $process, $properties, $key = 'uuid', $
219219
// Check if exist
220220
$exist = $process->media()->where($key, $properties[$key])->exists();
221221
if (!$exist) {
222+
// Define the custom properties
223+
$customProperties = [
224+
'media_type' => $mediaType,
225+
'type' => $properties['type'],
226+
];
227+
if ($mediaType === 'slideshow') {
228+
$customProperties['node_id'] = $properties['node_id'] ?? '';
229+
}
222230
// Store the images related move to MEDIA
223231
$process->addMediaFromBase64($properties['url'])
224-
->withCustomProperties([
225-
'media_type' => $mediaType,
226-
'type' => $properties['type'],
227-
'node_id' => $properties['node_id'],
228-
])
232+
->withCustomProperties($customProperties)
229233
->toMediaCollection($collectionName);
230234
}
231235
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('process_slideshow', function (Blueprint $table) {
15+
$table->id();
16+
$table->uuid('uuid')->unique();
17+
$table->unsignedInteger('process_id')->unique();
18+
$table->unsignedInteger('user_id')->nullable();
19+
$table->enum('published_version', ['A', 'B', 'AB']);
20+
$table->unsignedInteger('process_version_a_id')->constrained('process_versions')->nullable();
21+
$table->unsignedInteger('process_version_b_id')->constrained('process_versions')->nullable();
22+
$table->boolean('is_enable')->default(false);
23+
$table->string('url')->nullable()->index();
24+
$table->timestamps();
25+
// Foreign keys
26+
$table->foreign('process_id')->references('id')->on('processes')->onDelete('cascade');
27+
});
28+
}
29+
30+
/**
31+
* Reverse the migrations.
32+
*/
33+
public function down(): void
34+
{
35+
Schema::dropIfExists('process_slideshow');
36+
}
37+
};

0 commit comments

Comments
 (0)