<?php

namespace App\Http\Controllers;

use App\Models\Room;
use Illuminate\Http\Request;

class RoomController extends Controller
{
    public function index()
    {
        $rooms = Room::all();
        return view('rooms.index', compact('rooms'));
    }

    public function show($slug)
    {
        $room = Room::where('slug', $slug)->firstOrFail();
        $relatedRooms = Room::where('id', '!=', $room->id)->take(3)->get();
        
        return view('rooms.show', compact('room', 'relatedRooms'));
    }
}

