Bewerbungsformular update

This commit is contained in:
Nils Bonorden committed 2025-10-24 15:05:16 +02:00
1 parent 20558065ad
commit bdb62a6ce2
13 files changed
+646 -171

No files matched your search

@@ -0,0 +1,58 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\BandApplication;
use App\Models\Bewerbung;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\StreamedResponse;
class BandApplicationAdminController extends Controller
{
// Einzelansicht einer Bewerbung
public function show(BandApplication $application)
{
$application->load(['band','bewerbung']);
return view('admin.applications.show', compact('application'));
}
// Status ändern (submitted, in_review, accepted, rejected)
public function updateStatus(Request $request, BandApplication $application)
{
$data = $request->validate([
'status' => ['required','in:submitted,in_review,accepted,rejected'],
]);
$application->update($data);
return back()->with('success', 'Status aktualisiert.');
}
// Optional: CSV-Export aller Bewerbungen einer Runde
// public function exportCsv(Bewerbung $bewerbung): StreamedResponse
// {
// $filename = 'applications_' . $bewerbung->slug . '.csv';
// $headers = [
// 'Content-Type' => 'text/csv',
// 'Content-Disposition' => 'attachment; filename="'.$filename.'"',
// ];
// $callback = function() use ($bewerbung) {
// $handle = fopen('php://output', 'w');
// fputcsv($handle, ['ID','Band','Email','Status','Datum','Demo','Nachricht']);
// foreach ($bewerbung->applications()->with('band')->cursor() as $app) {
// fputcsv($handle, [
// $app->id,
// optional($app->band)->name,
// optional($app->band)->email,
// $app->status,
// $app->created_at,
// $app->demo_link,
// preg_replace("/\r|\n/", " ", (string)$app->message),
// ]);
// }
// fclose($handle);
// };
// return response()->stream($callback, 200, $headers);
// }
}
@@ -0,0 +1,33 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Bewerbung;
use Illuminate\Http\Request;
class BewerbungAdminController extends Controller
{
// Übersicht aller Runden
public function index(Request $request)
{
$bewerbungen = Bewerbung::query()
->withCount('applications')
->orderByDesc('start_at')
->orderBy('name')
->paginate(20);
return view('admin.bewerbungen.index', compact('bewerbungen'));
}
// Detailseite einer Runde mit Bewerbungs-Tabelle
public function show(Bewerbung $bewerbung)
{
$applications = $bewerbung->applications()
->with('band')
->latest()
->paginate(25);
return view('admin.bewerbungen.show', compact('bewerbung','applications'));
}
}