<?php

namespace App\Http\Controllers;

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

class BinController extends Controller
{
    public function index()
    {
        // Show all rejected or deleted members
        $members = Member::where('status', 'rejected')->orWhere('status', 'deleted')->get();
        return view('bin.index', compact('members'));
    }

    public function destroy($id)
    {
        $member = Member::findOrFail($id);
        $member->delete();

        return redirect()->route('bin.index')->with('success', 'Member permanently deleted.');
    }

    public function restore($id)
    {
        $member = Member::withTrashed()->findOrFail($id);
        $member->restore();

        return redirect()->route('bin.index')->with('success', 'Member restored successfully.');
    }
}
