quality schema
This commit is contained in:
parent
173e2009c5
commit
61fc2b4c96
3 changed files with 74 additions and 2 deletions
BIN
database/assets/schema.png
Normal file
BIN
database/assets/schema.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
71
database/migrations/2024_06_21_145915_qa_section.php
Normal file
71
database/migrations/2024_06_21_145915_qa_section.php
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Enums\Sections\PageSectionEnum;
|
||||||
|
use App\Lib\Helpers\FileStorageHelper;
|
||||||
|
use App\Models\Section;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Collection::macro('insertAfter', function ($target, $value, $new_key = null) {
|
||||||
|
if (is_int($target)) {
|
||||||
|
$this->items = array_merge(array_slice($this->items, 0, $target + 1), [$value], array_slice($this->items, $target + 1));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->items as $key => $old) {
|
||||||
|
$new[$key] = $old;
|
||||||
|
if ($key === $target && is_null($new_key)) {
|
||||||
|
$new[] = $value;
|
||||||
|
} elseif ($key === $target) {
|
||||||
|
$new[$new_key] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->items = $new;
|
||||||
|
});
|
||||||
|
|
||||||
|
$quality = Section::query()->where('section', PageSectionEnum::produce_quality)->first();
|
||||||
|
if ($quality) {
|
||||||
|
$data = collect($quality->data);
|
||||||
|
$data->insertAfter(
|
||||||
|
'bloc_text_de_la_partie2_content',
|
||||||
|
collect(Section::emptyPictureBloc([], FileStorageHelper::storeFile(
|
||||||
|
new Section(),
|
||||||
|
new \SplFileInfo(\resource_path(
|
||||||
|
'../database/assets/schema.png'
|
||||||
|
))
|
||||||
|
), fake()->sentence(), fake()->sentence(), 1208, 374))->first(),
|
||||||
|
'bloc_image_de_la_partie2_content'
|
||||||
|
);
|
||||||
|
$quality->data = $data->all();
|
||||||
|
$quality->saveQuietly();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
$rhd = Section::query()->where('section', PageSectionEnum::produce_rhd)->first();
|
||||||
|
if ($rhd) {
|
||||||
|
$data = collect($rhd->data);
|
||||||
|
$data->forget('bloc_lien_de_limage1_de_la_partie1');
|
||||||
|
$rhd->data = $data->all();
|
||||||
|
$rhd->saveQuietly();
|
||||||
|
} //end if
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -154,8 +154,9 @@
|
||||||
<div class="bg-tertiary-light rounded-4 my-3 p-4">
|
<div class="bg-tertiary-light rounded-4 my-3 p-4">
|
||||||
<div class="ck-content">{!! clean($qualitySection->data['bloc_text_de_la_partie2_content']['value']) !!}</div>
|
<div class="ck-content">{!! clean($qualitySection->data['bloc_text_de_la_partie2_content']['value']) !!}</div>
|
||||||
<div class="d-flex justify-content-center align-items-center mt-3">
|
<div class="d-flex justify-content-center align-items-center mt-3">
|
||||||
<img class="img-fluid" src="{{ Vite::asset('resources/assets/images/produce/schema.png') }}"
|
<img class="img-fluid" src="{{ $qualitySection->data['bloc_image_de_la_partie2_content']['value'] }}"
|
||||||
title="{{ __('Schéma') }}" alt="{{ __('Plein de formes différentes') }}">
|
title="{{ $qualitySection->data['bloc_image_de_la_partie2_content']['title'] }}"
|
||||||
|
alt="{{ $qualitySection->data['bloc_image_de_la_partie2_content']['alt'] }}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue