51 lines
1.5 KiB
PHP
51 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Models\Kuesioner;
|
|
use App\Models\ProfileSekolah;
|
|
use App\Models\Master\FormKriteria;
|
|
use App\Models\Penilaian;
|
|
|
|
class HomeController extends Controller
|
|
{
|
|
protected $template = 'modules.dashboard';
|
|
|
|
/**
|
|
* Create a new controller instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
$this->middleware('auth');
|
|
}
|
|
|
|
/**
|
|
* Show the application dashboard.
|
|
*
|
|
* @return \Illuminate\Contracts\Support\Renderable
|
|
*/
|
|
public function index()
|
|
{
|
|
return view('home');
|
|
}
|
|
|
|
public function dashboard()
|
|
{
|
|
$data['title'] = 'Dashboard';
|
|
$data['group'] = session('group_alias');
|
|
if(session('group_alias') == 'sekolah'){
|
|
$data['usulan'] = Kuesioner::where('ms_sekolah_id',session('sekolah_id'))->where('tahun',date('Y'))->first();
|
|
$data['profile'] = ProfileSekolah::where('ms_sekolah_id',session('sekolah_id'))->first();
|
|
$data['page'] = FormKriteria::select('page_number')->groupBy('page_number')->orderBy('page_number','ASC')->pluck('page_number')->count();
|
|
$data['penilaian'] = Penilaian::select('page_number')->groupBy('page_number')->orderBy('page_number','ASC')->pluck('page_number')->count();
|
|
|
|
return view($this->template.'.sekolah', $data);
|
|
}else{
|
|
return view($this->template.'.admin', $data);
|
|
}
|
|
}
|
|
}
|