Phase 6 (Teil 1): Dokumente und Organigramm
- Dokumente-Plugin: Ordnerbaum mit vererbten Rechten und Sichtbarkeit, Hochladen per Ziehen und Ablegen, Versionen, Suche, Pagebuilder-Block - Organigramm aus den Vorgesetzten, Vorgesetzte im Admin pflegbar - Personensuche im Kopf übernimmt nur noch Suchbegriffe des Verzeichnisses Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
21c706e5f5
commit
d6d5d4b0fe
110 changed files with 2209 additions and 208 deletions
47
plugins-core/documents/src/Models/DocumentVersion.php
Normal file
47
plugins-core/documents/src/Models/DocumentVersion.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Documents\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 Fassung eines Dokuments. Die Datei liegt außerhalb von public/ und
|
||||
* wird nur an Personen ausgeliefert, die den Ordner sehen dürfen.
|
||||
*/
|
||||
#[Fillable(['document_id', 'version', 'name', 'path', 'mime', 'size', 'note', 'uploaded_by', 'created_at'])]
|
||||
class DocumentVersion extends Model
|
||||
{
|
||||
public const DISK = 'local';
|
||||
|
||||
public const UPDATED_AT = null;
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::deleted(fn (DocumentVersion $version) => Storage::disk(self::DISK)->delete($version->path));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<Document, $this>
|
||||
*/
|
||||
public function document(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Document::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue