Parcourir la source

add $excludeChannels

visuddhinanda il y a 2 ans
Parent
commit
04be67445a
1 fichiers modifiés avec 8 ajouts et 2 suppressions
  1. 8 2
      app/Http/Controllers/SentenceController.php

+ 8 - 2
app/Http/Controllers/SentenceController.php

@@ -89,6 +89,8 @@ class SentenceController extends Controller
                 $channelPub = $channelTable->where('status',30)->get();
                 $channelPub = $channelTable->where('status',30)->get();
 
 
                 $user = AuthApi::current($request);
                 $user = AuthApi::current($request);
+                $channelShare=array();
+                $channelMy=array();
                 if($user){
                 if($user){
                     //自己的
                     //自己的
                     $channelMy = Channel::where('owner_uid',$user['user_uid'])
                     $channelMy = Channel::where('owner_uid',$user['user_uid'])
@@ -125,9 +127,13 @@ class SentenceController extends Controller
                     ];
                     ];
                 }
                 }
                 $channels = [];
                 $channels = [];
+                $excludeChannels = explode(',',$request->get('channels')) ;
+
                 foreach ($channelCanRead as $key => $value) {
                 foreach ($channelCanRead as $key => $value) {
                     # code...
                     # code...
-                    $channels[] = $key;
+                    if(!in_array($key,$excludeChannels)){
+                        $channels[] = $key;
+                    }
                 }
                 }
                 $sent = explode('-',$request->get('sentence')) ;
                 $sent = explode('-',$request->get('sentence')) ;
                 $table = Sentence::select($indexCol)
                 $table = Sentence::select($indexCol)
@@ -136,7 +142,7 @@ class SentenceController extends Controller
                                 ->where('paragraph',$sent[1])
                                 ->where('paragraph',$sent[1])
                                 ->where('word_start',$sent[2])
                                 ->where('word_start',$sent[2])
                                 ->where('word_end',$sent[3]);
                                 ->where('word_end',$sent[3]);
-
+                break;
             case 'chapter':
             case 'chapter':
                 $chapter =  PaliTextApi::getChapterStartEnd($request->get('book'),$request->get('para'));
                 $chapter =  PaliTextApi::getChapterStartEnd($request->get('book'),$request->get('para'));
                 $table = Sentence::where('book_id',$request->get('book'))
                 $table = Sentence::where('book_id',$request->get('book'))