app/Http/Controllers/HomeController.php
/**
     * Show the application dashboard.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */
Show the application dashboard.
@return \Illuminate\Contracts\Support\Renderable
Show the application dashboard . @return \ Illuminate \ Contracts \ Support \ Renderable
public function index()
    {
        $transaksi = Transaksi::get();
        $anggota   = Anggota::get();
        $buku      = Buku::get();
        $user      = User::get();
        if(Auth::user()->level == 'user')
        {
            $datas = Transaksi::where('status', 'pinjam')
                                ->where('anggota_id', Auth::user()->anggota->id)
                                ->get();
        } else {
            $datas = Transaksi::where('status', 'pinjam')->get();
        }
        return view('home', compact('transaksi', 'anggota', 'buku', 'datas', 'user'));
    }
public function index ( ) { $ transaksi = Transaksi :: get ( ) ; $ anggota = Anggota :: get ( ) ; $ buku = Buku :: get ( ) ; $ user = User :: get ( ) ; if ( Auth :: user ( ) -> level == 'user' ) { $ datas = Transaksi :: where ( 'status' , 'pinjam' ) -> where ( 'anggota_id' , Auth :: user ( ) -> anggota -> id ) -> get ( ) ; } else { $ datas = Transaksi :: where ( 'status' , 'pinjam' ) -> get ( ) ; } return view ( 'home' , compact ( 'transaksi' , 'anggota' , 'buku' , 'datas' , 'user' ) ) ; }
Show the application dashboard.
Show the application dashboard .