app/Http/Controllers/UrlController.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)
    {
        $data = Url::where("user_id", "=", Auth::user()->id)
            ->where(function ($query) {
                $query->where("target", "LIKE", "%" . request('q', "") . "%")
                    ->orWhere("custom_key", "LIKE", "%" . request('q', "") . "%");
            })
            ->orderBy('created_at', 'DESC')
            ->paginate(5);
        return view('url.index', compact('data'))
            ->with('i', (request()->input('page', 1) - 1) * 5);
    }
public function index ( Request $ request ) { $ data = Url :: where ( " user_id " , " = " , Auth :: user ( ) -> id ) -> where ( function ( $ query ) { $ query -> where ( " target " , " LIKE " , " % " . request ( 'q' , " " ) . " % " ) -> orWhere ( " custom_key " , " LIKE " , " % " . request ( 'q' , " " ) . " % " ) ; } ) -> orderBy ( 'created_at' , 'DESC' ) -> paginate ( 5 ) ; return view ( 'url.index' , compact ( 'data' ) ) -> with ( 'i' , ( request ( ) -> input ( 'page' , 1 ) - 1 ) * 5 ) ; }
Display a listing of the resource.
Display a listing of the resource .