It is provided for developers to use. Unless required by plug-ins or themes, it is useless for ordinary users to download.
I believe that some of you who use Laravel also know how comfortable ORM is to use. Now it's here!!!
Need to prepare:
php >= 7.3
Configure composer
Familiarity with namespaces and autoloading
It can be used after installation, for example:
1. Create a new composer.json file in any directory in the theme or plug-in, and write the following code:
{
"autoload": {
"psr-4": {
"ModelsDemo\\": "./ModelsDemo",
"ObserverDemo\\": "./ObserverDemo"
}
}
}
Note: To avoid conflicts, automatically loaded namespaces and folder names are marked with the ID of the theme or plug-in
2. Execute composer dump autoload configuration automatic loading
3. Introduce autoload.php into include.php of the theme or plug-in, such as:
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR.'/ vendor/autoload.php';
For specific usage, see Larravel ORM Document , does not support the use of facade classes. For transaction related information, please refer to the methods of Models/BaseModel in the plug-in. Other operations remain unchanged.
Code cloud address: https://gitee.com/SongHaiFeng/Zblog-Eloquent-ORM
#Update 2022.09.01
Pose a transaction
Add global Zblog_Eloquent_ORM attribute
Adjust DOC Document
See the DOC.md file under the plug-in for the specific use method
#Update 2022.05.17
Adjust a problem last updated
Adjust system tables to use default database links by default
#Updated on April 16, 2022.02
New CustomPaginate method for paging
#Update 2021.11.24
Support conversion table coding
Support configuration of multiple databases
#Updated on May 11, 2021.01
Add support for paging, for example:
$post = \Models\Post::query()->paginate(10, ['*'], 'p', GetVars('p', 'GET', 1));
echo \Base\Pagination::paginate($post);
This is a bootstrap compliant paging html structure. If it returns null, no paging exists.
In addition, the pageName of paginate method is page by default, and the paging parameter of zblog is also page by default, so you need to specify that the paging parameter is p and must be p.