With the laravel framework, you can enter the homepage without logging in. How to set up routing?

WBOY
Release: 2023-03-01 17:44:01
Original
2134 people have browsed it

Laravel framework, you can enter the homepage without logging in. How to set up routing?

Reply content:

Laravel framework, you can enter the homepage without logging in. How to set up routing?

Just don’t put it in auth middleware.

Route::any('/', 'HomeController@index ');

You can use except in the controller, the key depends on how you write the middleware

<code>public function __construct() {
        $this->middleware('auth', ['except' => [
            //排除的路由
        ]]);
}</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!