Public Access
59 lines
2.0 KiB
PHP
59 lines
2.0 KiB
PHP
<?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);
|
|
// }
|
|
}
|