当前位置:网站首页>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;
边栏推荐
- Lintcode 130 · 堆化
- Refined operation, extending the full life cycle value LTV
- Vscode solves the problem of Chinese garbled code
- How do consumer goods enterprises formulate membership interests?
- 十大券商有哪些?手机开户安全么?
- MOS管基本原理,单片机重要知识点
- 证券账户一般需要在哪里开通 开户安全吗
- Investment planning and forecast report on the future direction of China's smart agriculture during the 14th five year plan (2022)
- Comparison of latest mobile phone processors in 2020 (with mobile phone CPU ladder diagram)
- 统计遗传学:第二章,统计分析概念
猜你喜欢
How to calculate flops and params in deep learning
HUST网络攻防实践|6_物联网设备固件安全实验|实验二 基于 MPU 的物联网设备攻击缓解技术
Statistical genetics: Chapter 2, the concept of statistical analysis
TCP interview
HUST network attack and defense practice | 6_ IOT device firmware security experiment | Experiment 2 MPU based IOT device attack mitigation technology
This executeQuery (SQL) cannot compile classes for JSP. What is the reason?
哈希表的前置知识---二叉搜索树
Black squares in word
Omnichannel membership - tmall membership 1: opening tutorial
Spark-day01- get started quickly
随机推荐
统计遗传学:第一章,基因组基础概念
Measures to support the development of cultural and creative industries in Futian District, Shenzhen
PolarisMesh系列文章——概念系列(一)
Introduction to Dolby panoramic sound
The loss of female scientists
CG bone animation
Scala problem solving the problem of slow SBT Download
Cross platform members get through the two channels of brand Ren Du
国际美妆业巨头押注中国
The best CMDB system
Leetcode 78. Subset and 90 Subset II
China's smart toy market outlook and investment strategy consulting forecast report from 2022 to 2027
UDP协议详解[通俗易懂]
How to calculate flops and params in deep learning
Demand scale forecast and investment competitiveness analysis report of China's new material market 2022-2028
开通证券账户需要注意事项 开户安全吗
2016年四川省TI杯电子设计竞赛B题
MOS管基本原理,单片机重要知识点
leetcode 715. Range 模块 (hard)
Lintcode 130 · stacking