<?php

namespace App\Http\Controllers\Operator;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Kelompok;
use App\Http\Controllers\GetDataApiController;

use Session;

class SelectController extends Controller
{
    public function mahasiswa()
    {
        $nim = request('nim');
        $kelompok_id = Session::get('ss_kelompokid');
        $kelompok   = Kelompok::with(['rKetua', 'rAnggota'])->where('kelompok_id', $kelompok_id)->first();

        $person = GetDataApiController::getAccount($nim);

        $data = [
            'person' => $person,
            'kelompok' => $kelompok
        ];

        if ($person) {
            return view('backend.mahasiswa.kelompok.personil.viewanggota', $data);
        } else {
            return view('backend.mahasiswa.kelompok.personil.emptyanggota', $data);
        }
    }
}
