table with hotels
This commit is contained in:
@@ -8,17 +8,11 @@ use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
/**
|
||||
* Показать форму входа.
|
||||
*/
|
||||
public function showLoginForm()
|
||||
{
|
||||
return view('admin.login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Обработать вход пользователя.
|
||||
*/
|
||||
public function login(Request $request)
|
||||
{
|
||||
$credentials = $request->validate([
|
||||
@@ -37,14 +31,14 @@ class AuthController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Выход пользователя.
|
||||
* Выход из системы.
|
||||
*/
|
||||
public function logout(Request $request)
|
||||
{
|
||||
Auth::logout();
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
Auth::logout();
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
|
||||
return redirect()->route('admin.login.form');
|
||||
return view('admin.logout');
|
||||
}
|
||||
}
|
||||
|
||||
11
app/Http/Controllers/Admin/AvailabilityController.php
Normal file
11
app/Http/Controllers/Admin/AvailabilityController.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AvailabilityController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
11
app/Http/Controllers/Admin/BookingController.php
Normal file
11
app/Http/Controllers/Admin/BookingController.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class BookingController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -8,70 +8,51 @@ use Illuminate\Http\Request;
|
||||
|
||||
class HotelController extends Controller
|
||||
{
|
||||
/**
|
||||
* Показать список отелей.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$hotels = Hotel::all();
|
||||
return response()->view('admin/hotels/index', compact('hotels'));
|
||||
return view('admin.hotels.index', compact('hotels'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Показать форму создания отеля.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin.hotels.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Сохранить новый отель.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'address' => 'nullable|string',
|
||||
'phone' => 'nullable|string',
|
||||
'phone' => 'nullable|string|max:20',
|
||||
]);
|
||||
|
||||
Hotel::create($validated);
|
||||
|
||||
return redirect()->route('admin.hotels.index')->with('success', 'Отель добавлен!');
|
||||
return redirect()->route('admin.hotels.index')->with('success', 'Отель успешно добавлен!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Показать форму редактирования отеля.
|
||||
*/
|
||||
public function edit(Hotel $hotel)
|
||||
{
|
||||
return view('admin.hotels.edit', compact('hotel'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Обновить отель.
|
||||
*/
|
||||
public function update(Request $request, Hotel $hotel)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'address' => 'nullable|string',
|
||||
'phone' => 'nullable|string',
|
||||
'phone' => 'nullable|string|max:20',
|
||||
]);
|
||||
|
||||
$hotel->update($validated);
|
||||
|
||||
return redirect()->route('admin.hotels.index')->with('success', 'Отель обновлён!');
|
||||
return redirect()->route('admin.hotels.index')->with('success', 'Отель успешно обновлён!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Удалить отель.
|
||||
*/
|
||||
public function destroy(Hotel $hotel)
|
||||
{
|
||||
$hotel->delete();
|
||||
|
||||
return redirect()->route('admin.hotels.index')->with('success', 'Отель удалён!');
|
||||
return redirect()->route('admin.hotels.index')->with('success', 'Отель удалён.');
|
||||
}
|
||||
}
|
||||
}
|
||||
11
app/Http/Controllers/Admin/RoomTypeController.php
Normal file
11
app/Http/Controllers/Admin/RoomTypeController.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RoomTypeController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
Reference in New Issue
Block a user