Basic routing
The vast majority of your application's routes will be defined in the app/routes.php file. The simplest route in Laravel consists of a URI and a closure call.
Basic GET routing
Routing parameters
Route Filter
Route filters provide a simple way to restrict access to specific routes, which is useful when you need to create zones for your site that require authentication. The Laravel framework contains some routing filters, such as auth filter, auth.basic filter, guest filter, and csrf filter. They are stored in the app/filters.php file.
Define a route filter
Specify a route filter for a route
You may wish to specify filters for a set of routes based on URI.
You can also constrain pattern filters by specifying the HTTP method:
Filter class
For advanced filters, you can use a class instead of a closure function. Because the filter class is an IoC container that lives outside the application, you can use dependency injection in the filter, making it easier to test.
Define a filter class
Named Route
Named routes make it easier to specify routes when generating redirects or URLs. You can give the route a name like this:
Routing Group
Sometimes you may want to apply a filter to a set of routes. You don't have to specify filters for each route, you can use route groups:
Subdomain name routing
Laravel routing can also handle wildcard subdomains and obtain wildcard parameters from the domain name:
Register subdomain routing
Routing prefix
A group of routes can be prefixed by using the prefix option in the properties array:
Add prefix to routing group
Route model binding
Model binding provides a simple way to inject models into routes. For example, instead of just injecting a user's ID, you can inject an entire user model instance based on a specified ID. First use the Route::model method to specify the required model:
Bind a variable to the model
Since we have bound the {user} parameter to the User model, a User instance will be injected into the route. So, for example, a request for profile/1 will inject a User instance with ID 1.
Note: If this model instance is not found in the database, a 404 error will be raised.
If you wish to specify your own behavior that is not found, you can pass a closure as the third parameter to the model method:
There are two ways to manually trigger a 404 error in routing. First, you can use the App::abort method:
Second, you can throw an instance of SymfonyComponentHttpKernelExceptionNotFoundHttpException.
More information about handling 404 exceptions and using custom responses for these errors can be found in the Errors chapter.
Route to controller
Laravel not only allows you to route to closures, but also to controller classes, and even allows you to create resource controllers.
Please visit the controller documentation for more information.
You cannot set the IP of two computers to be the same. Try 192.168.133.32 or other numbers but not 33
First of all, you should get a fixed IP address. Your company's network itself is the LAN IP. You can also use any computer IP you use as a static IP for wireless routing, for example: 192.168. 2.101, then you set it up as follows
Wireless Router Setting Tutorial Example
Before configuring the wireless router, we must first connect the relevant lines. First plug the network cable connected to the Internet into the WAN port of the wireless router. Then we need a computer to connect to the LAN port of the router through the network cable to perform relevant configurations on the router. First, make sure that the local computer operating system has the TCP/IP protocol installed. This step can be ignored for users with Windows 2000 or above. Since the default address of the router is 192.168.1.1 and the subnet mask is 255.255.255.0, we must manually set the local connection address to be within the same network segment to configure the router normally, that is, set the local connection address to 192.168. 1.xxx (xxx=2~254).
The subnet mask is 255.255.255.0. After the setting is completed, open IE and enter the default address of 192.168.1.1 wireless router. The above window will pop up, asking the user to enter the administrator's user name and password. The username and password can be obtained from the product manual, usually admin.
General routers can be managed directly through the Web, and the same is true for this router. The interface uses full Chinese settings, which will bring certain convenience to domestic users. After logging in, IE automatically pops up a window with a product setup wizard that allows users to quickly and easily complete the settings of the wireless router. After clicking Next, the three most common network login methods are provided. Taking the most common ADSL as an example, we choose the PPPoE virtual dial-up method and click Next. Then we are asked to enter the account and password to log in to the network, and then click Next to enter. Wireless settings page.
Here is a brief introduction to the detailed functions of several options on the wireless router setup tutorial page. If the wireless function is selected to be turned on, the host connected to the wireless network will be able to access the limited network; the SSID number, that is, The login name of the wireless LAN is used for authentication. Only users who pass the authentication can access the wireless network;
frequency band is used to determine the wireless frequency band used by the wireless router. The selection range is from 1 to 11. The most commonly used channel is channel 11, which is two signals in the 2.4GHz band. Only if there is a frequency difference of more than 4, the signals will not interfere with each other (so channel 6 and channel 11 are usually used together). Mode, you can choose the 802.11b mode with 11Mbps bandwidth and the 802.11g mode with 54Mbps bandwidth (also compatible with 802.11b mode). After the configuration is completed, click Next to complete.
After completion, we click on the running status on the Web page. We can see that the router still does not have a dial-up connection. We need to manually click on the connection before we can access the Internet. After connection, we can see various statuses in the router on this page, such as LAN port status, which is the default address of the current router, wireless status, which is the relevant setting options in wireless routing, and WAN port status, which is obtained after accessing the Internet. address as well as the gateway and DNS server address of the ISP provider, and can also count the online time of the router and control the connection status of the router.
After completing the above steps, the configuration of the wireless router can be said to be basically completed. Computers connected locally through network cables and computers connected through wireless network cards can realize the Internet access function through wireless routing, so the configuration Wireless routing is not as abstract and complex as everyone thinks.
The setting of the wireless network card is also very simple. After inserting the wireless network card, install the relevant driver according to the prompts and you can use it. After the user completes the configuration of the wireless router, the computer with the wireless network card installed will automatically search for the relevant wireless network, and then the user can easily connect to the wireless LAN by clicking Connect to realize file sharing and Internet connection functions. When the user clicks the wireless network status icon in the lower right corner, the above window will appear. This window can display the network connection speed and signal strength. Although the signal strength is not very accurate, it still has certain reference value. In this window...the rest of the text>>