浏览代码

Update CommentController

Daniel Supernault 7 年之前
父节点
当前提交
82add854a8
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      app/Http/Controllers/CommentController.php

+ 7 - 1
app/Http/Controllers/CommentController.php

@@ -33,6 +33,12 @@ class CommentController extends Controller
 
       NewStatusPipeline::dispatch($reply, false);
 
-      return redirect($status->url());
+      if($request->ajax()) {
+        $response = ['code' => 200, 'msg' => 'Comment saved'];
+      } else {
+        $response = redirect($status->url());
+      }
+
+      return $response;
     }
 }