app/Http/Controllers/ProdiController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index()
    {
        $data = DB::table('prodis')
            ->orderBy('created_at', 'desc')
            ->get();
        if (request()->ajax()) {
            return datatables()->of($data)
                ->addColumn('aksi', function ($data) {
                    $button = "<button class='edit mb-2 mr-2 btn-sm btn-icon btn-icon-only btn-pill btn btn-outline-link text-warning' id='" . $data->id . "'><i class='lnr-pencil btn-icon-wrapper'></i></button>";
                    $button .= "<button class='hapus mb-2 mr-2 btn-sm btn-icon btn-icon-only btn-pill btn btn-outline-link text-danger' id='" . $data->id . "'><i class='lnr-trash btn-icon-wrapper'> </i></button>";
                    return $button;
                })
                ->rawColumns(['aksi'])
                ->make(true);
        }
        return view('administrator.contents.prodi');
    }
public function index ( ) { $ data = DB :: table ( 'prodis' ) -> orderBy ( 'created_at' , 'desc' ) -> get ( ) ; if ( request ( ) -> ajax ( ) ) { return datatables ( ) -> of ( $ data ) -> addColumn ( 'aksi' , function ( $ data ) { $ button = " <button class='edit mb-2 mr-2 btn-sm btn-icon btn-icon-only btn-pill btn btn-outline-link text-warning' id=' " . $ data -> id . " '><i class='lnr-pencil btn-icon-wrapper'></i></button> " ; $ button .= " <button class='hapus mb-2 mr-2 btn-sm btn-icon btn-icon-only btn-pill btn btn-outline-link text-danger' id=' " . $ data -> id . " '><i class='lnr-trash btn-icon-wrapper'> </i></button> " ; return $ button ; } ) -> rawColumns ( [ 'aksi' ] ) -> make ( true ) ; } return view ( 'administrator.contents.prodi' ) ; }
Display a listing of the resource.
Display a listing of the resource .
// $data = Category::get(); // <button class="mb-2 mr-2 btn-icon btn-icon-only btn-shadow btn-outline-2x btn btn-outline-primary"><i class="lnr-store btn-icon-wrapper"> </i></button>