Advertisement
fadlyshafa

Untitled

Mar 31st, 2020
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.58 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Http\Controllers\Dashboard;
  4.  
  5. use Illuminate\Http\Request;
  6. use App\Http\Controllers\Controller;
  7.  
  8. use App\Models\Biodata;
  9. use App\Models\Data_sekolah_sebelumnya;
  10. use App\User;
  11.  
  12. class Beranda_controller extends Controller
  13. {
  14.     public function index(){
  15.         $title = 'Halaman Dashboard';
  16.  
  17.         $user_id = \Auth::user()->id;
  18.  
  19.         $jumlah_peserta = User::whereNull('role')->count();  
  20.  
  21.         $jumlah_laki = User::where('jenis_kelamin',1)->count();
  22.  
  23.         $jumlah_perempuan = User::where('jenis_kelamin',2)->count();
  24.  
  25.         $jumlah_sd = Data_sekolah_sebelumnya::where('asal_sekolah','sd')->count();
  26.  
  27.         $jumlah_mi = Data_sekolah_sebelumnya::where('asal_sekolah','mi')->count();
  28.  
  29.         $cek = Biodata::where('users',$user_id)->count();
  30.         if($cek < 1){
  31.             $pesan = 'Harap Melengkapi Biodata Terlebih Dahulu';
  32.         }else{
  33.             $pesan = 'Terima Kasih. Biodata Anda Sudah Lengkap';
  34.         }
  35.  
  36.         $cek_verifikasi = User::find($user_id);
  37.  
  38.         if($cek_verifikasi->is_verifikasi == 1){
  39.             $status = 'Status Sudah Di verifikasi';
  40.         }else{
  41.             $status = 'Belum Diverifikasi';
  42.         }
  43.  
  44.         $cek_lulus = User::find($user_id);
  45.         if($cek_lulus->is_lulus == 1){
  46.             $pesan_lulus = 'Selamat Anda Diterima';
  47.         }else{
  48.             $pesan_lulus = '';
  49.         }
  50.  
  51.  
  52.  
  53.         return view('dashboard.beranda.index',compact('title','pesan','cek','status','pesan_lulus','jumlah_peserta','jumlah_laki','jumlah_perempuan','jumlah_sd','jumlah_mi'));
  54.     }
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement