input('sentences'); $query = []; foreach ($sent as $value) { # code... $ids = explode('-', $value); if (count($ids) === 4) { $query[] = $ids; } } $channelsQuery = array(); $channelsInput = $request->input('channels'); foreach ($channelsInput as $value) { if (Str::isUuid($value)) { $channelsQuery[] = $value; } else { $channelId = ChannelApi::getSysChannel($value); if ($channelId) { $channelsQuery[] = $channelId; } } } $table = Sentence::select([ 'id', 'book_id', 'paragraph', 'word_start', 'word_end', 'content', 'content_type', 'editor_uid', 'channel_uid', 'updated_at' ]) ->whereIn('channel_uid', $channelsQuery) ->whereIns(['book_id', 'paragraph', 'word_start', 'word_end'], $query); $result = $table->get(); return $this->ok(["rows" => $result, "count" => count($result)]); } /** * Display the specified resource. * * @param \App\Models\Sentence $sentence * @return \Illuminate\Http\Response */ public function show(Sentence $sentence) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param \App\Models\Sentence $sentence * @return \Illuminate\Http\Response */ public function update(Request $request, Sentence $sentence) { // } /** * Remove the specified resource from storage. * * @param \App\Models\Sentence $sentence * @return \Illuminate\Http\Response */ public function destroy(Sentence $sentence) { // } }