/
ghx
/
TicketFlow
Обзор
Документация
Войти
/
ghx
/
TicketFlow
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
app/Http/Controllers/Admin/HallController.php
63 строки
2 KB
osnov
.
26 июн 2026, 11:56
26 июн 2026, 11:56
dc2de34
Код
Авторство
О чём код?
<?php namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use App\Models\Hall; use App\Services\HallSeatService; use Illuminate\Http\Request; class HallController extends Controller { public function index() { $halls = Hall::withCount('sessions')->latest()->paginate(15); return view('admin.halls.index', compact('halls')); } public function create() { return view('admin.halls.create'); } public function store(Request $request) { $validated = $request->validate([ 'name' => 'required|string|max:255', 'rows' => 'required|integer|min:1|max:50', 'seats_per_row' => 'required|integer|min:1|max:50', ]); $hall = Hall::create($validated); app(HallSeatService::class)->syncSeats($hall); return redirect()->route('admin.halls.index')->with('success', 'Зал создан.'); } public function edit(Hall $hall) { return view('admin.halls.edit', compact('hall')); } public function update(Request $request, Hall $hall) { $validated = $request->validate([ 'name' => 'required|string|max:255', 'rows' => 'required|integer|min:1|max:50', 'seats_per_row' => 'required|integer|min:1|max:50', ]); $hall->update($validated); app(HallSeatService::class)->syncSeats($hall->fresh()); return redirect()->route('admin.halls.index')->with('success', 'Зал обновлён.'); } public function destroy(Hall $hall) { $hall->delete(); return redirect()->route('admin.halls.index')->with('success', 'Зал удалён.'); } }