public function getAll($subtopic_name) { $me = SubTopic::where('name', $subtopic_name)->get()->toArray(); $arr = $me[0]; $subtopic_code = $arr["subtopic_code"]; $content = Content::where('subtopic_code', $subtopic_code)->get(); return view('sources')->with(['allcontent' => $content, 'subtopic_name' => $subtopic_name]); }
public function search($tag) { $tuple = SubTopic::where('tags', $tag)->get()->toArray(); if ($tuple == null) { return view('search')->with('message', 'not found'); } $tuple = $tuple[0]; $subtopic_code = $tuple['subtopic_code']; dd($subtopic_code); $sources = Content::where('subtopic_code', $subtopic_code)->get()->toArray(); return view('search')->with('message', $sources); }