<?php

declare(strict_types=1);

namespace App\Http\Controllers;

use App\Models\Place;
use Illuminate\View\View;

class PlacesController extends Controller
{
    /**
     * Show all the places.
     *
     * @return \Illuminate\View\View
     */
    public function index(): View
    {
        $places = Place::all();

        return view('allplaces', ['places' => $places]);
    }

    /**
     * Show a specific place.
     *
     * @param  string  $slug
     * @return \Illuminate\View\View
     */
    public function show(string $slug): View
    {
        $place = Place::where('slug', '=', $slug)->firstOrFail();

        return view('singleplace', ['place' => $place]);
    }
}
