Browse Source

showByName 没有查到channel 返回 404

visuddhinanda 2 năm trước cách đây
mục cha
commit
ebbd9c5ab7
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      app/Http/Controllers/ChannelController.php

+ 5 - 1
app/Http/Controllers/ChannelController.php

@@ -529,7 +529,11 @@ class ChannelController extends Controller
         //
         $indexCol = ['uid','name','summary','type','owner_uid','lang','is_system','status','updated_at','created_at'];
 		$channel = Channel::where("name",$name)->select($indexCol)->first();
-		return $this->ok(new ChannelResource($channel));
+        if($channel){
+            return $this->ok(new ChannelResource($channel));
+        }else{
+            return $this->error('no channel');
+        }
     }
 
     /**