app/Http/Controllers/KaryawanController.php
/**
     * Remove the specified resource from storage.
     *
     * @param  \App\Models\karyawan  $karyawan
     * @return \Illuminate\Http\Response
     */
Remove the specified resource from storage.
Remove the specified resource from storage .
public function destroy($id)
    {
        $karyawans = karyawan::find($id);
        $data_ktp = substr($karyawans->foto_ktp,66);
        $data_karyawan = substr($karyawans->foto_karyawan,66);
        if ($data_ktp && $data_karyawan) {
            unlink(public_path("uploads/$data_ktp"));
        unlink(public_path("uploads/$data_karyawan"));
        $karyawans->delete();
        }   $karyawans->delete();
        return redirect('/karyawan');
    }
public function destroy ( $ id ) { $ karyawans = karyawan :: find ( $ id ) ; $ data_ktp = substr ( $ karyawans -> foto_ktp , 66 ) ; $ data_karyawan = substr ( $ karyawans -> foto_karyawan , 66 ) ; if ( $ data_ktp && $ data_karyawan ) { unlink ( public_path ( " uploads/ $ data_ktp " ) ) ; unlink ( public_path ( " uploads/ $ data_karyawan " ) ) ; $ karyawans -> delete ( ) ; } $ karyawans -> delete ( ) ; return redirect ( '/karyawan' ) ; }
Remove the specified resource from storage.
Remove the specified resource from storage .