hapus

parent bede6672
...@@ -121,5 +121,12 @@ class KekayaanIntelController extends Controller ...@@ -121,5 +121,12 @@ class KekayaanIntelController extends Controller
*/ */
public function destroy($id) public function destroy($id)
{ {
try {
$kekayaan = KekayaanIntelektual::query()->findOrFail(decrypt($id));
$kekayaan->delete();
} catch (Exception $ex) {
}
return redirect()->route('kekayaanintelek.index');
} }
} }
...@@ -41,7 +41,12 @@ ...@@ -41,7 +41,12 @@
{{ $item->nidn }} {{ $item->nidn }}
</td> </td>
<td> <td>
<a class="btn btn-warning" href="{{ route('kekayaanintelek.edit', ['kekayaanintelek' => encrypt($item->id)]) }}"> Edit</a> <a class="btn btn-warning" href="{{ route('kekayaanintelek.edit', ['kekayaanintelek' => encrypt($item->id)]) }}">Hapus</a>
<button class="btn btn-danger" type="button" onclick="hapus('form_kekayaan_{{ $loop->iteration }}')">Hapus</button>
<form id="form_kekayaan_{{ $loop->iteration }}" action="{{ route('kekayaanintelek.destroy', ['kekayaanintelek' => encrypt($item->id)]) }}" method="POST">
{{ method_field('DELETE') }}
@csrf
</form>
</td> </td>
</tr> </tr>
@endforeach @endforeach
...@@ -70,6 +75,9 @@ ...@@ -70,6 +75,9 @@
"lengthMenu": [10, 20, 50], "lengthMenu": [10, 20, 50],
"pageLength": 10 "pageLength": 10
}); });
function hapus(id){
$('#'+id).submit();
}
</script> </script>
@endsection @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