[migration] add column harvest_json_path

This commit is contained in:
guillaume91 2024-05-21 16:26:05 +02:00
parent bace7a47c0
commit 0a37fd2d91
3 changed files with 49 additions and 1 deletions

View file

@ -61,10 +61,11 @@ private function loadFormData(Project $project)
{ {
$this->formData = $project->toArray(); $this->formData = $project->toArray();
$this->pivot_json_path = $this->formData['pivot_json_path']; $this->pivot_json_path = $this->formData['pivot_json_path'];
$this->formData['pivot_json_path'] = null;
$this->span_json_path = $this->formData['span_json_path']; $this->span_json_path = $this->formData['span_json_path'];
$this->harvest_json_path = $this->formData['harvest_json_path']; $this->harvest_json_path = $this->formData['harvest_json_path'];
$this->formData['pivot_json_path'] = null;
$this->formData['span_json_path'] = null; $this->formData['span_json_path'] = null;
$this->formData['harvest_json_path'] = null;
$this->formData['boundingBoxes'] = $project->boundingBoxes->toArray(); $this->formData['boundingBoxes'] = $project->boundingBoxes->toArray();
$this->formData['mail_recipients'] = $project->emailRecipients->toArray() ?: [ $this->formData['mail_recipients'] = $project->emailRecipients->toArray() ?: [
[ [

View file

@ -0,0 +1,19 @@
<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
class HarvestFile implements ValidationRule
{
/**
* Run the validation rule.
*
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
*/
public function validate(string $attribute, mixed $value, Closure $fail): void
{
//
}
}

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('projects', function (Blueprint $table) {
$table->string('harvest_json_path')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('projects', function (Blueprint $table) {
$table->dropColumn('harvest_json_path');
});
}
};