30 lines
1004 B
PHP
30 lines
1004 B
PHP
<?php
|
|
|
|
namespace App\Actions\Generate\Pdf;
|
|
|
|
use App\Actions\Generate\PdfGenerator;
|
|
use App\Models\ProjektPlatzhalter;
|
|
use Carbon\Carbon;
|
|
|
|
class Platzhalter
|
|
{
|
|
public static function replace($platzhalter, $standardtext)
|
|
{
|
|
return str_replace(array_keys($platzhalter), array_values($platzhalter), $standardtext);
|
|
}
|
|
|
|
public static function load($projekte_id)
|
|
{
|
|
$platzhalter = ProjektPlatzhalter::where('projekte_id', $projekte_id)->pluck('platzhaltertext', 'platzhalter')->toArray();
|
|
$platzhalter['###INTERNER_NAME###'] = PdfGenerator::$projekt->interner_name;
|
|
$platzhalter['###OFFIZIELLER_NAME###'] = PdfGenerator::$projekt->offizieller_name;
|
|
$platzhalter['###ORT###'] = PdfGenerator::$projekt->ort;
|
|
$platzhalter['###FIRMA###'] = PdfGenerator::$gutachter->company;
|
|
|
|
$dt = Carbon::create(PdfGenerator::$projekt->erstellung);
|
|
$platzhalter['###DATUM###'] = $dt->isoFormat('D. MMMM YYYY');
|
|
|
|
return $platzhalter;
|
|
}
|
|
}
|