think-repository
is a repository provided for thinkphp 6.0.*
for abstract data layer, Make our applications more flexible for maintenance.
You know
>= thinkphp 6.0.*
composer require fanxd/think-repository dev-master
Best##commandsUse
##Route
Available methods
Paging query
Find by result by id
##Load model relationship
Press Results are found by field name
Find by multiple fields
Find multiple values in one field by result
Find by results by excluding multiple values in a field
Write data
Update record
##Delete record$this->repository->delete($id)
Delete entries in the repository by multiple fields$this->repository->deleteWhere([
transformTransformer
The system will automatically generate the
<?php namespace app\api\transform;use fanxd\repository\command\transform\Transform;class PostTransform extends Transform{ public function transform($items) { return [ 'id' => $items['id'], //... 'createTime' => $items['create_time'], 'updateTime' => $items['update_time'] ]; }}
Related recommendations:
The latest 10 thinkphp video tutorials
The above is the detailed content of Introducing a useful ThinkPHP Repository package. For more information, please follow other related articles on the PHP Chinese website!