当前位置:网站首页>Share the easy-to-use fastadmin open source system - practical part
Share the easy-to-use fastadmin open source system - practical part
2022-06-28 11:47:00 【Programmer Xiao Peng】
One 、 Preface
Installation chapter : Share useful FastAdmin Open source system - Installation chapter Most companies have their own systems for internal use , Let customer service 、 Operational analysis data 、 View data usage , It is characterized by no complex business , Permission control is required , So we need a simple and convenient system . Today I will share with you the next PHP Open source background management system FastAdmin,FastAdmin It is very suitable for small and medium-sized background management systems , It can be used out of the box without secondary development , Suitable for the background of simple business , For example, you can view reports 、 Check the log 、 View records and other requirements , With my push , At present, our company has two back offices using the system .
Two 、 brief introduction
FastAdmin It's based on ThinkPHP5+Bootstrap Rapid background development framework . The system has built-in permission control 、 One click generation CRUD、 One click to generate controller menu and rules 、 One click generation API Interface document and other functions , There are also rich plug-ins that can be downloaded and used , Ecological convenience, very good . Let's use it step by step .
3、 ... and 、 Onekey CRUD
3.1 Add data sheet
To demonstrate CRUD function , We need a simple data sheet , perform SQL Statement to create a piece of data .
CREATE TABLE `fa_teacher` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` char(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT ' Teacher name ',
`sex` tinyint(3) NOT NULL DEFAULT '1' COMMENT ' Gender 1: male 2: Woman ',
`age` int(11) NOT NULL DEFAULT '0' COMMENT ' Age ',
`switch` tinyint(1) NOT NULL DEFAULT '1' COMMENT ' On state 1: Turn on 0: close ',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT ' Creation time ',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT=' The teacher table ';After the data table is created successfully , Let's insert some data .
INSERT INTO `fastdemo`.`fa_teacher`(`id`, `name`, `sex`, `age`, `switch`, `create_time`) VALUES (1, ' Zhang San ', 1, 20, 1, 1644761811);
INSERT INTO `fastdemo`.`fa_teacher`(`id`, `name`, `sex`, `age`, `switch`, `create_time`) VALUES (2, ' Li Si ', 1, 21, 1, 1644761822);
INSERT INTO `fastdemo`.`fa_teacher`(`id`, `name`, `sex`, `age`, `switch`, `create_time`) VALUES (3, ' test ', 2, 22, 1, 1644761831);
INSERT INTO `fastdemo`.`fa_teacher`(`id`, `name`, `sex`, `age`, `switch`, `create_time`) VALUES (4, ' Wang Wu ', 1, 23, 1, 1644761844);3.2 download CRUD plug-in unit
We log in to the system background and click the plug-in management list , Search for crud, Click on the install , Note that you also need to log in to your official account . After successful installation, it will be displayed in the menu bar on the left “ Online command management ”, If not, clear the cache .

3.3 perform CRUD command
Click the online command management menu on the left , Click Add , Generate in one click CRUD Under the tab, select the data table we want to generate , You can also select an association model to complete the join query . Field identification can be set , After setting, we scroll down , Turn to the bottom , Click execute now . You can view the execution results in the command management list .


Four 、 One click menu generation
In the previous step, we generated by one click CRUD after , At this time, the code has been generated , Let's add a menu , Or click the Add button , Select the one click generate menu , Select the controller corresponding to the data table name generated in the previous step , That is to say Teacher.php controller , Click the execute now button , You can see the teacher management list on the left .

We can see the previously inserted data records in the teacher management list , You can also add 、 Delete 、 edit 、 Search function .

5、 ... and 、 Analyze the source code
View the requested address through the console shown above , Called teacher controller , Check the source code and find that there is no implementation in the controller crud, But inherited Backend.

Teacher.php The controller inherits Backend controller ,Backend The controller is introduced into the controller traits Under the Backend.php.

because traits\Backend Used trait,trait Is the solution PHP A code reuse mechanism prepared for single inheritance , Other classes do not inherit traits Under the Backend.php, As long as this class is referenced , You can use the methods in the class . This class implements the basic CRUD function , This eliminates the need to write duplicate code in each controller .

6、 ... and 、 Conclusion
The introduction of this system ends here from installation to application , You can explore other functions by yourself , Thank you for reading , See you next time .
边栏推荐
- 关于Pytorch中双向LSTM的输出表示问题
- recent developments
- 2022 开源软件安全状况报告:超41%的企业对开源安全没有足够的信心
- Practice and Thinking on the architecture of a set of 100000 TPS im integrated message system
- 水果FL Studio/Cubase/Studio one音乐宿主软件对比
- 面试步骤的面试技巧
- 工作组环境下的内网渗透:一些基础打法
- 行业分析| 快对讲,楼宇对讲
- Day39 prototype chain and page Fireworks Effect 2021.10.13
- Random forest and poetry maker trained by AMR
猜你喜欢

Deployment and optimization of vsftpd service

New listing of operation light 3.0 - a sincere work of self subversion across the times!

TiDB v6.0.0 (DMR) :缓存表初试丨TiDB Book Rush

Making and using of static library

Array method in JS 2021.09.18

day37 js笔记 运动函数 2021.10.11

QML控件类型:TabBar

Fancy features and cheap prices! What is the true strength of Changan's new SUV?

Fruit FL studio/cubase/studio one music host software comparison

Unity screenshot function
随机推荐
使用logrotate对宝塔的网站日志进行自动切割
When an entity is converted to JSON, the field with null value is lost
The default point of this in JS and how to modify it to 2021.11.09
Download and install mysql5.7 for windows 10
[semidrive source code analysis] [x9 chip startup process] 32 - play module analysis - RTOS side
day29 js笔记 2021.09.23
Array method in JS 2021.09.18
Chapter 2 do you remember the point, line and surface (2)
近况
Allez, Meta - Cosme, comme prévu, cette chaleur ne durera pas longtemps.
day37 js笔记 运动函数 2021.10.11
东方财富手机股票开户哪个券商更安全更方便?
Machine learning project captcha based on verification code recognition_ Trainer operation practice
面试步骤的面试技巧
一套十万级TPS的IM综合消息系统的架构实践与思考
Unity screenshot function
Mysql使用max函数查询不到最大值
Day24 JS notes 2021.09.15
[sciter]:sciter如何使用i18实现桌面应用多语言切换及其利弊
day24 js笔记 2021.09.15