


With the rapid development of Internet technology, Web development has become the most popular technology at present. Many developers need to perform database operations in their daily work, and in most cases the operations involved are additions, deletions, modifications, and searches. So, how can these operations be completed quickly and efficiently?
For PHP developers, there is a very convenient way to automatically generate the addition, deletion, modification and query functions with one click, and that is to use the third-party class library "CRUDBooster".
CRUDBooster is an open source PHP class library that can quickly generate a management background interface. Developers only need to perform simple configuration to use it. Let’s learn how to use CRUDBooster!
1. CRUDBooster installation and settings
- First you need to download CRUDBooster. You can download it from GitHub and extract it to the project directory.
-
Set permissions and auto-loading. Create a
app
directory in the project root directory, then create aHttp
directory under theapp
directory, and create aHttp
directory under it AControllers
directory. Finally, create a file namedCRUDController.php
in theHttp
directory, and add the following code to the file:<?php namespace App\Http\Controllers; use crocodicstudio\crudbooster\controllers\CBController; class CRUDController extends CBController { public function __construct() { $this->table = "table_name"; $this->primary_key = "id"; $this->title_field = "name"; } }
Among them,
table_name
is the name of the table that needs to be operated,id
is the name of the primary key field in the table,name
is the name of the field that displays the name in the table. -
Create a controller. Create a file named
SampleController.php
in theapp/Http/Controllers
directory, and add the following code to the file:<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Controllers\Controller; class SampleController extends Controller { public function index() { return view('sample.index'); } }
-
Create view files. Create a directory named
sample
under theresources/views
directory, and create a file namedindex.blade.php
in that directory. Add the following code to the file:@extends('crud::sample.layout') @section('content') <h1 id="Hello-World">Hello World</h1> @endsection
-
Add routes to the
routes/web.php
fileRoute::get('/', 'SampleController@index'); Route::get('admin/sample', 'Admin\CRUDController@index'); Route::get('admin/sample/add', 'Admin\CRUDController@add'); Route::post('admin/sample/add', 'Admin\CRUDController@addSave'); Route::get('admin/sample/detail/{id}', 'Admin\CRUDController@detail'); Route::get('admin/sample/edit/{id}', 'Admin\CRUDController@edit'); Route::post('admin/sample/edit/{id}', 'Admin\CRUDController@editSave'); Route::get('admin/sample/delete/{id}', 'Admin\CRUDController@delete');
At this point, the installation and settings of CRUDBooster have been completed. Next, we can start using it to automatically generate additions, deletions, modifications and queries with one click.
2. Use CRUDBooster to automatically generate the add, delete, modify and query function
Since we have specified the table name, primary key field name and display name field name that need to be operated in the controller code, therefore , we only need to execute the following command to quickly generate the management background interface:
php artisan crudbooster:install
After running this command, CRUDBooster will automatically generate the add, delete, modify and check function, and will also generate the login page of the management background. We can pass Access the /admin path to enter the management background.
At this point, we can see the newly generated add, delete, modify and query pages under the /admin/sample
path. They are all based on Bootstrap style, and have implemented table search, Sorting, paging and other functions. In addition, CRUDBooster also generates functions such as data form validation and permission management for us.
There are many other powerful functions in CRUDBooster, such as file upload, email sending, data export, etc., which will not be described here.
3. Summary
Using CRUDBooster to automatically generate one-click addition, deletion, modification and query functions will undoubtedly make developers’ work more efficient and convenient. The advantage of CRUDBooster is not only that it is easy to use, rich in functions, and highly customizable, but also that it follows the best practices of the Laravel framework and can be easily integrated with Laravel projects.
I hope the above content can inspire and help everyone, thank you!
The above is the detailed content of Detailed explanation of the installation and settings of PHP CRUDBooster. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Chinese version
Chinese version, very easy to use

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
