Commit a4badc42 by Farendi Giotivano R.P

Merge branch 'master' of http://git.unesa.ac.id/farendi/simlitabmas into master

parents 0ed4ead1 8fca8e8a
......@@ -196,9 +196,8 @@ class PenelitianSumberDanaController extends Controller
DB::beginTransaction();
$penelitian = PenelitianSumber::query()->find(decrypt($id));
$anggota = $penelitian->anggota;
$anggota->delete();
$penelitian->anggota()->delete();
$penelitian->delete();
DB::commit();
......
......@@ -9,6 +9,7 @@ use App\Models\User\PublikasiJurnalAnggota;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Validator;
class PublikasiJurnalController extends Controller
......@@ -241,6 +242,20 @@ class PublikasiJurnalController extends Controller
*/
public function destroy($id)
{
//
try{
DB::beginTransaction();
$penelitian = PublikasiJurnal::query()->find(decrypt($id));
$penelitian->anggota()->delete();
$penelitian->delete();
DB::commit();
return redirect()->route('publikasijurnal.index');
}
catch(Exception $ex){
DB::rollBack();
return redirect()->route('publikasijurnal.index');
}
}
}
......@@ -80,5 +80,26 @@
"lengthMenu": [10, 20, 50],
"pageLength": 10
});
$("body").on("click", ".delete", function (e) {
e.preventDefault();
var id = $(this).data('target');
Swal.fire({
title: "Apakah Anda Yakin?",
text: "Anda akan menghapus data ini!",
icon: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes",
cancelButtonText: "No"
}).then((result) => {
if (result.value) {
Swal.close();
$("#"+id).submit();
} else if (result.dismiss === Swal.DismissReason.cancel) {
Swal.fire('Dibatalkan', 'Data batal dihapus', 'error');
}
});
});
</script>
@endsection
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment