feat: Initialize core application structure including authentication, role-based dashboards, service task management, and integration workflows.

This commit is contained in:
jeremy bayse
2026-02-16 09:30:23 +01:00
commit af060a8847
208 changed files with 26822 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Http\Controllers;
use App\Models\Attachment;
use App\Models\ServiceTask;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
class AttachmentController extends Controller
{
public function store(Request $request, ServiceTask $task)
{
$request->validate([
'file' => 'required|file|max:10240', // 10MB max
]);
$file = $request->file('file');
$originalName = $file->getClientOriginalName();
$filename = time() . '_' . $originalName;
$path = $file->storeAs('attachments/' . $task->id, $filename, 'public');
$attachment = $task->attachments()->create([
'filename' => $filename,
'original_name' => $originalName,
'path' => $path,
'mime_type' => $file->getMimeType(),
'size' => $file->getSize(),
]);
return back()->with('success', 'Fichier ajouté avec succès.');
}
public function download(Attachment $attachment)
{
return Storage::disk('public')->download($attachment->path, $attachment->original_name);
}
public function destroy(Attachment $attachment)
{
Storage::disk('public')->delete($attachment->path);
$attachment->delete();
return back()->with('success', 'Fichier supprimé.');
}
}