app/Http/Controllers/SearchController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index(Request $request)
    {
        $videos = DB::table('videos')
                    ->join('video_tags', 'video_tags.video_id', '=', 'videos.id')
                    ->join('tags', 'tags.id', '=', 'video_tags.tag_id')
                    ->select('videos.*')
                    ->where('videos.title', 'LIKE', '%'.$request->search.'%' )
                    ->orWhere('tags.title', 'LIKE', '%'.$request->search.'%' )
                    ->where('videos.status', '1')
                    ->orderBy('videos.id', 'desc')
                    ->distinct('videos.id')
                    ->paginate(16);
        $search = $request->search;
        return view('search', compact('videos', 'search'));
    }
public function index ( Request $ request ) { $ videos = DB :: table ( 'videos' ) -> join ( 'video_tags' , 'video_tags.video_id' , '=' , 'videos.id' ) -> join ( 'tags' , 'tags.id' , '=' , 'video_tags.tag_id' ) -> select ( 'videos.*' ) -> where ( 'videos.title' , 'LIKE' , '%' . $ request -> search . '%' ) -> orWhere ( 'tags.title' , 'LIKE' , '%' . $ request -> search . '%' ) -> where ( 'videos.status' , '1' ) -> orderBy ( 'videos.id' , 'desc' ) -> distinct ( 'videos.id' ) -> paginate ( 16 ) ; $ search = $ request -> search ; return view ( 'search' , compact ( 'videos' , 'search' ) ) ; }
Display a listing of the resource.
Display a listing of the resource .
// Videos                                 // Search Keyword Display