Neues Modul: Qualitätsmanagement
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m46s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m51s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m2s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m55s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 4m15s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 4m16s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 3m44s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 3m46s
CI / Build-Artefakte aktuell (pull_request) Successful in 52s
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m46s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m51s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m2s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m55s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 4m15s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 4m16s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 3m44s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 3m46s
CI / Build-Artefakte aktuell (pull_request) Successful in 52s
- Kategorien mit farbigen Ordnerkacheln; Farbe und Symbol je Ordner (Auswahl oder eigener Upload, SVG bereinigt), an Unterordner vererbt - Ordnerseite: Einführungstext, Ansprechpartner (Profilfelder wählbar), Unterordner, Liste mit Dokument, Version, Stand, Größe, Aktion - Einträge: Datei (Lesefassung + bearbeitbare Vorlage), Link, Online-Formular; neue Fassungen archivieren die bisherigen - PDF-Betrachter im Portal (pdf.js) - Eigene Volltextsuche (PDF, Word, Excel, PowerPoint, OpenDocument) mit Textausschnitt; optionale Texterkennung per Tesseract - Rollen-Ausschluss für das ganze Modul, Pflegerecht qm.manage, Zielgruppen je Kategorie - Vorbereitet: Wiedervorlage, Verantwortliche, Lesebestätigungen - Abhängigkeit smalot/pdfparser Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f78cc96be7
commit
b3a057e27c
218 changed files with 13478 additions and 358 deletions
71
plugins-core/qm/src/Models/QmFile.php
Normal file
71
plugins-core/qm/src/Models/QmFile.php
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Qm\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* Eine Datei eines QM-Eintrags. Aktuelle Fassung: archived_at = null.
|
||||
* Frühere Fassungen bleiben im Archiv (Nachvollziehbarkeit).
|
||||
*/
|
||||
#[Fillable(['entry_id', 'kind', 'version', 'valid_from', 'name', 'path', 'mime', 'size', 'text', 'text_status', 'archived_at', 'uploaded_by', 'created_at'])]
|
||||
class QmFile extends Model
|
||||
{
|
||||
public const DISK = 'local';
|
||||
|
||||
public const READING = 'reading';
|
||||
|
||||
public const EDITABLE = 'editable';
|
||||
|
||||
public const UPDATED_AT = null;
|
||||
|
||||
/** Im Browser lesbar (eigener Betrachter). */
|
||||
public const VIEWABLE = ['application/pdf', 'image/jpeg', 'image/png', 'image/gif', 'image/webp'];
|
||||
|
||||
protected $hidden = ['text'];
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::deleted(fn (QmFile $file) => Storage::disk(self::DISK)->delete($file->path));
|
||||
}
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['valid_from' => 'date', 'archived_at' => 'datetime', 'created_at' => 'datetime'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<QmEntry, $this>
|
||||
*/
|
||||
public function entry(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(QmEntry::class, 'entry_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<User, $this>
|
||||
*/
|
||||
public function uploader(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'uploaded_by');
|
||||
}
|
||||
|
||||
public function extension(): string
|
||||
{
|
||||
return strtoupper(pathinfo($this->name, PATHINFO_EXTENSION));
|
||||
}
|
||||
|
||||
public function isViewable(): bool
|
||||
{
|
||||
return in_array($this->mime, self::VIEWABLE, true);
|
||||
}
|
||||
|
||||
public function url(bool $inline = false): string
|
||||
{
|
||||
return route('qm.file', ['file' => $this->id, 'name' => $this->name]).($inline ? '?lesen=1' : '');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue