app/Http/Controllers/SparePartController.php
/**
     * Remove the specified resource from storage.
     *
     * @param  \App\Models\SparePart  $sparePart
     * @return \Illuminate\Http\Response
     */
Remove the specified resource from storage.
Remove the specified resource from storage .
public function destroy(SparePart $sparepart)
    {
        $exists = Storage::exists('public/berkas/ccr/'.$sparePart->ccr_file);
        if ($exists) {
            Storage::delete('public/berkas/ccr/'.$sparePart->ccr_file);
        }
        $sparePart->delete();
        return redirect()->route('sparepart.index')->with('success', 'Data Sparepart berhasil dihapus');
    }
public function destroy ( SparePart $ sparepart ) { $ exists = Storage :: exists ( 'public/berkas/ccr/' . $ sparePart -> ccr_file ) ; if ( $ exists ) { Storage :: delete ( 'public/berkas/ccr/' . $ sparePart -> ccr_file ) ; } $ sparePart -> delete ( ) ; return redirect ( ) -> route ( 'sparepart.index' ) -> with ( 'success' , 'Data Sparepart berhasil dihapus' ) ; }
Remove the specified resource from storage.
Remove the specified resource from storage .
// dd($sparepart->id);