承接 mmx/database 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mmx/database

最新稳定版本:1.3.1

Composer 安装命令:

composer require mmx/database

包简介

Eloquent for MODX 3

README 文档

README

This extra is part of MMX initiative - the Modern MODX approach.

Prepare

This package can be installed only with Composer.

If you are still not using Composer with MODX 3, just download the composer.json of your version:

cd /to/modx/root/
wget https://raw.githubusercontent.com/modxcms/revolution/v3.0.4-pl/composer.json

Then run composer update --no-dev and you are ready to install the mmx packages.

Install

composer require mmx/database --update-no-dev
composer exec mmx-database install

Remove

composer exec mmx-database remove
composer remove mmx/database

How to use

mmxDatabase service will be registered globally, so you can use its models anywhere in your PHP code inside MODX.

Get all published resources with Template and TV values.

$resources = \MMX\Database\Models\Resource::query()
    ->with('Template:id,templatename')
    ->with('TvValues')
    ->where('published', true)
    ->get();
foreach ($resources as $resource) {
    print_r($resource->toArray());
}

Get categories with relations:

$categories = \MMX\Database\Models\Category::query()
    ->with('Templates')
    ->with('Plugins')
    ->with('Snippets')
    ->with('Chunks')
    ->with('Tvs')
    ->get();
foreach ($categories as $category) {
    print_r($category->toArray());
}

You can see all currently available models with their relations in Models directory.

Do not forget to read the official Eloquent documentation.

Nota bene!

mmxDatabase models are not contain any MODX related logic, like clearing cache or calling plugin events.

This is just a convenient way to work with MODX database directly, without xPDO.

Project is still under development, do not hesitate to use issues if you have any.

统计信息

  • 总下载量: 892
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 2
  • 依赖项目数: 6
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固