<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\Registrasi;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;

class AdminController extends Controller
{
    public function index_peserta(){
        $peserta = Registrasi::with('pkKegiatan', 'pkKonferensi')->get();
        $data = [
            'peserta' => $peserta
        ];

        return view('admin.peserta.index', $data);
    }

    public function delete_participant($id) {
        DB::beginTransaction();

        try{
            Registrasi::find($id)->delete();
            DB::commit();
        }
        catch(Exception $e){
            Log::error($e);
            DB::rollBack();
        }
    }
}
