当前位置:网站首页>New routing file in laravel framework
New routing file in laravel framework
2022-06-26 12:22:00 【Special sword】
Laravel Add routing file
Laravel8.x Add a new route file method
- Go to the project root directory \app\Providers\RouteServiceProvider.php
- stay public function boot() Method to add a new routing file address , Here's the picture
Route::prefix('merchants/v1_0') # Prefix ->middleware('api') # middleware ->namespace($this->namespace) ->group(base_path('routes/merchants_v1_0.php'));# The path where the new route file is located

Laravel5.x Add a new route file method
- Get into Project root \app\Providers\RouteServiceProvider.php In file
- Add a custom method in this file mapApiRoutes_v1_0() The method name is defined by itself , My custom name is mapApiRoutes_v1_0
- In the custom method **mapApiRoutes_v1_0()** Add the following code to
/** * api v1.0 Version routing file */ protected function mapApiRoutes_v1_0() { Route::prefix('api') # Route prefix ( There can be no ) ->middleware('api') # middleware ->namespace($this->namespace) ->group(base_path('routes/api_v1_0.php')); # Location of the new route file } - stay **\app\Providers\RouteServiceProvider.php Find map() Method will be the custom method we just added mapApiRoutes_v1_0()** Add in
/** * Define the routes for the application. * * @return void */ public function map() { $this->mapApiRoutes(); $this->mapWebRoutes(); // $this->mapApiRoutes_v1_0();#api v1.0 Version routing file ←←←←← The routing file method we just added $this->mapApiRoutes_v1_1();#api v1.1 Version routing file $this->mapWebApiRoutes_v1_0();#WebApi v1.0 Version routing file }

End;
边栏推荐
- Hello! Forward proxy!
- Pratique de l'attaque et de la défense du réseau HUST | 6 Expérience de sécurité du microprogramme de l'équipement IOT | expérience 2 technologie d'atténuation des attaques de l'équipement IOT basée s
- What are the top ten securities companies? Is it safe to open a mobile account?
- Notice on printing and Distributing Measures for supporting strategic emerging industries and future industrial cluster development in Futian District, Shenzhen
- The loss of female scientists
- [graduation season · advanced technology Er] I remember the year after graduation
- Build document editor based on slate
- Precautions for opening a securities account is it safe to open an account
- Introduction to Dolby panoramic sound
- Spark-day02-core programming-rdd
猜你喜欢

Re recognized! Know that Chuangyu has been selected as one of the first member units of the "business security promotion plan"

Quantitative elementary -- akshare obtains stock code, the simplest strategy

How to calculate flops and params in deep learning

科技兴关,荣联与天津海关共建基因组数据库及分析平台
女性科学家的流失

1、 MySQL introduction
![[graduation season · advanced technology Er] I remember the year after graduation](/img/e7/8e1dafa561217b77a3e3992977a8ec.png)
[graduation season · advanced technology Er] I remember the year after graduation

Spark-day02-core programming-rdd

量化初级 -- akshare获得股票代码,最简策略

leetcode 715. Range 模块 (hard)
随机推荐
【毕业季·进击的技术er】忆毕业一年有感
The most complete kubernetes core command of the latest version so far
Oracle lock table query and unlocking method
2016年四川省TI杯电子设计竞赛B题
Current situation investigation and investment prospect forecast analysis report of China's electrolytic copper market from 2022 to 2028
2022 edition of Beijing 5g industry investment planning and development prospect forecast analysis report
Microservice governance (nocas)
What are the top ten securities companies? Is it safe to open a mobile account?
How do consumer goods enterprises formulate membership interests?
fastjson的JSONArray和JSONObject[通俗易懂]
国际美妆业巨头押注中国
Scala-day05-set
Operation analysis and investment prospect research report of China's organic chemical raw material manufacturing industry 2022-2028
Is it safe to open a securities account in general
Hello! Forward proxy!
Loggie encoding and newline character test
Member system + enterprise wechat + applet to help the efficient transformation of private domain
Build Pikachu shooting range and introduction
Consumer goods enterprises, four pain points of member marketing
18: Chapter 3: development of pass service: 1: SMS login & registration process, introduction; (SMS verification code is used here)