<?php

namespace App\Http\Controllers\Web;

use App\Http\Controllers\Controller;
use App\Models\Success;
use Illuminate\Http\Request;

class SuccessPageController extends Controller
{
    public function index()
    {
        $allSuccesses = Success::query()->latest()->get();

        return view('web.pages.success.index', compact('allSuccesses'));
    }

    public function show($success)
    {
        $success = Success::where('slug', $success)->firstOrFail();
        $recentSuccesses = Success::query()->latest()->limit(3)->get();

        return view('web.pages.success.show', compact('success', 'recentSuccesses'));
    }
}
