<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class AdminPenelitianController extends Controller
{
    public function judulpenelitian()
    {
        $data['objek'] = \App\Judulpenelitian::latest()->paginate(5);
        return view('administrator.penelitian.judul_penelitian',$data);
    }
    public function detailJudulpenelitian($id){
        $registrasi = \App\Judulpenelitian::findOrFail($id);

        return view('administrator.penelitian.judul-form', compact('registrasi'));
    }
    public function statusJudulpenelitian($id){
        $registrasi = \App\Judulpenelitian::findOrFail($id);
        $registrasi->statusjudul_id = 2;
        $registrasi->save();
        return back()->with('pesan','Data Telah diubah');
    }

    public function proposal()
    {
        $data['objek'] = \App\Proposal::latest()->paginate(5);
        return view('administrator.penelitian.proposal',$data);
    }
    public function detailProposal($id){
        $registrasi = \App\Proposal::findOrFail($id);

        return view('administrator.penelitian.proposal-form', compact('registrasi'));
    }
    public function statusProposal($id){
        $registrasi = \App\Proposal::findOrFail($id);
        $registrasi->statusjudul_id = 2;
        $registrasi->save();
        return back()->with('pesan','Data Telah diubah');
    }


    public function laporan()
    {
       
        $data['objek'] = \App\Laporan::latest()->paginate(5);
        return view('administrator.penelitian.laporan',$data);
     
    }
    public function detailLaporan($id){
        $registrasi = \App\Laporan::findOrFail($id);

        return view('administrator.penelitian.laporan-form', compact('registrasi'));
    }
    public function statusLaporan($id){
        $registrasi = \App\Laporan::findOrFail($id);
        $registrasi->status = 'diterima';
        $registrasi->save();
        return back()->with('pesan','Data Telah diubah');
    }
}
