Przeglądaj źródła

临时工登记系统

ANG YU 4 lat temu
rodzic
commit
5eea29c96c

+ 2 - 1
app/Http/Controllers/LaborApplyController.php

@@ -86,7 +86,8 @@ class LaborApplyController extends Controller
      */
     public function destroy(LaborApply $laborApply)
     {
-        //
+        $laborApply->delete();
+        return redirect(route('laborApply.index'))->with('success', '删除成功');
     }
 
     /**

+ 11 - 3
resources/views/personnel/laborApply/index.blade.php

@@ -34,8 +34,16 @@
                     <td>
                         <a v-if="labor_apply.status === '创建'" :href="getEditlUrl(labor_apply)"
                            class="btn btn-outline-secondary btn-sm" role="button">修改</a>
-
-                        <form v-if="labor_apply.status === '劳务接单'" :action="getUpdatelUrl(labor_apply)" method="post"
+                        <form v-if="labor_apply.status === '创建'" :action="getBaseUrl(labor_apply)" method="post"
+                              style="display: inline-block;"
+                              onsubmit="return confirm('您确定要删除吗?');">
+                            {{ csrf_field() }}
+                            {{ method_field('DELETE') }}
+                            <button type="submit" class="btn btn-outline-danger btn-sm">
+                                <i class="far fa-trash-alt"></i> 删除
+                            </button>
+                        </form>
+                        <form v-if="labor_apply.status === '劳务接单'" :action="getBaseUrl(labor_apply)" method="post"
                               style="display: inline-block;">
                         {{ csrf_field() }}
                         {{ method_field('PATCH') }}
@@ -140,7 +148,7 @@
                 getEditlUrl(obj) {
                     return "{{ url('personnel/laborApply') }}/" + obj.id + '/edit';
                 },
-                getUpdatelUrl(obj) {
+                getBaseUrl(obj) {
                     return "{{ url('personnel/laborApply') }}/" + obj.id;
                 },