Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
378 views
in Technique[技术] by (71.8m points)

php - Laravel routes to authentication page

I am new to Laravel and want to search via YouTube Data API, but when I click the search button it routes me to the login page. Cannot see the result unless logging in.

The controller search function:

    public function search(Request $request)
    {
        $keyword = $request->keyword;
        $params = [
            'q'             => $keyword,
            'type'          => 'video',
            'part'          => 'id, snippet',
            'maxResults'    => 5,
            'order' => $request->orderby,
            'videoDuration' => $request->duration,
            'location' => $request->latitude ? $request->latitude.', '. $request->longitude : '40.936714, 29.012689',
            'locationRadius' => $request->radius ? $request->radius.'km' : '100km'
        ];

        $searchResults = Youtube::searchAdvanced($params, true);

       
         $channelIds= array();
         $channels= array();
         
        foreach($searchResults["results"] as $el){
            array_push($channelIds,$el->snippet->channelId);            
        }
    
         foreach($channelIds as $id){
                $channel = Youtube::getChannelById($id);
                 array_push($channels,$channel);
         }
         $channels=array_unique($channels);
        return view('welcome2', compact('searchResults', 'keyword', 'channels'));
    }

this is my search page: localhost

After clicking search, the URL turns into localhost:8000/login.

When looking at the web.php, I cannot see /login route. Do not understand where is the problem:

Route::name('welcome')->get('/', 'PresentationController@index');

Route::name('youtube.search')->get('/youtube/search','YoutubeController@search');

Auth::routes();


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...