定制 cboxdk/statamic-reverse-relationship 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

cboxdk/statamic-reverse-relationship

Composer 安装命令:

composer require cboxdk/statamic-reverse-relationship

包简介

Traverse relationships in reverse — see which entries, terms, or assets reference the current item without storing anything on it.

README 文档

README

A Statamic addon that lets you traverse relationships in reverse. If entry B points to entry A, this addon lets A see all the B's that reference it — from a single source of truth, with no duplicated data and nothing to keep in sync.

Works with entries, taxonomy terms, and assets.

The Problem

You have a comments collection where each comment points to a blog post. You want the blog post to show its comments. Without this addon, you'd have to manually maintain a list of comment IDs on each post — duplicating data and hoping it stays in sync.

The Solution

Add the reverse_relationship fieldtype to your blog post blueprint, tell it to look in the comments collection for entries whose post field points here, and you're done:

- handle: comments
  field:
    type: reverse_relationship
    collection: comments
    field: post

Then use it in your templates — just like any native Statamic field:

{{ comments sort="date:desc" limit="5" }}
    <p>{{ author }}: {{ content }}</p>
{{ /comments }}

Features

  • Fieldtype — add to any blueprint, works like a native entries field in templates
  • Antlers tag — query reverse relationships from any template, no blueprint required
  • Editable mode — attach/detach related items directly from the CP
  • Lazy query builderlimit, sort, paginate, count, and scoped variables
  • Three modes — entries, taxonomy terms, and assets

Quick Start

composer require cboxdk/statamic-reverse-relationship

No config files, no publishing, no migrations.

Documentation

See DOCUMENTATION.md for full setup guide, templating examples, and configuration reference.

Requirements

  • PHP 8.2+
  • Statamic 6.x
  • Laravel 12+

Development

composer check    # Pint + PHPStan level 9 + Pest (69 tests)

License

MIT

Credits

Originally designed and developed by Sylvester Damgaard while working at TV2 Regionerne. Now maintained and actively developed under Cbox with a full rewrite for Statamic 6, Laravel 12, and Vue 3.

统计信息

  • 总下载量: 404
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固