PHPackages                             izica/relations-widgets-for-backpack - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. izica/relations-widgets-for-backpack

ActiveLibrary[Admin Panels](/categories/admin)

izica/relations-widgets-for-backpack
====================================

Widgets for preview model relations in laravel backpack

3.3.2(3y ago)2930.2k↓44.8%14[1 issues](https://github.com/izica/relations-widgets-for-backpack/issues)MITBlade

Since Jul 8Pushed 3y ago4 watchersCompare

[ Source](https://github.com/izica/relations-widgets-for-backpack)[ Packagist](https://packagist.org/packages/izica/relations-widgets-for-backpack)[ Docs](https://github.com/izica/relations-widgets-for-backpack)[ RSS](/packages/izica-relations-widgets-for-backpack/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (1)Versions (20)Used By (0)

Laravel Backpack Relations Widgets
----------------------------------

[](#laravel-backpack-relations-widgets)

1. [Installation](#installation)
2. [Screenshots](#screenshots)
3. [Features](#features)
4. [Documentation](#documentation)
5. [Usage](#usage)
6. [How to enable creating related model](#how-to-enable-creating-related-model)

### 3.0 Whats new:

[](#30-whats-new)

- relation\_table search input
- relation\_table create button with relation attribute reference
- relation\_table pagination

[![Alt text](screenshots/relation_table_with_options.png?raw=true "relation_table_with_options")](screenshots/relation_table_with_options.png?raw=true)

### Installation

[](#installation)

```
composer require izica/relations-widgets-for-backpack

```

### Screenshots

[](#screenshots)

[![Alt text](screenshots/relation_panel.png?raw=true "relation_panel")](screenshots/relation_panel.png?raw=true)[![Alt text](screenshots/relation_table.png?raw=true "relation_table")](screenshots/relation_table.png?raw=true)

### Features

[](#features)

- use widgets for showing relations in show operation
- show or hide panels or fields by conditions
- build field value by closure
- use dot orm notation for accessing relation fields

### Documentation

[](#documentation)

- relation\_panel

    - `name` - name of relation
    - `label` - panel label
    - `backpack_crud` - backpack crud url,
    - `buttons` (optional) - set `false` to hide all action buttons
    - `button_show` (optional) - set `false` to hide
    - `button_edit` (optional) - set `false` to hide
    - `visible` (optional) - closure for hiding or showing panel
    - `fields` (optional) - fields array, by default get columns from `fillable` in model
        - `name` - name
        - `label` - for field
        - `closure` - use closure instead of name field,
        - `visible`(optional) - closure for hiding or showing panel
- relation\_table

    - `name` - (required) name of relation
    - `label` - panel label
    - `relation_attribute` - (optional) used for passing url parameter name for button\_create
    - `search` - (optional) `closure`, enables search input
    - `per_page` - (optional) enables pagination, `null` by default
    - `backpack_crud` - backpack crud url,
    - `buttons` (optional) - set `false` to hide all action buttons
    - `button_create` (optional) - set `false` to hide
    - `button_show` (optional) - set `false` to hide
    - `button_edit` (optional) - set `false` to hide
    - `button_delete` (optional) - set `false` to hide
    - `visible` (optional) - `closure` for hiding or showing panel
    - `columns` (optional) - columns `array`, by default get columns from `fillable` in model
        - `name` - name
        - `label` - for field
        - `closure` - use `closure` instead of name field for passing value,

### Usage

[](#usage)

#### Relation panel

[](#relation-panel)

`belongsTo`, `hasOne`

```
use Backpack\CRUD\app\Library\Widget;

protected function setupShowOperation()
{
    Widget::add([
        'type'           => 'relation_panel',
        'name'           => 'account_contact',
        'label'          => 'Account contact info',
        'backpack_crud'  => 'accountcontact',
        'visible' => function($entry){
            return $entry->is_public_person;
        },
        'buttons' => false,
        'fields'         => [
            [
                'label' => 'Birthdate',
                'closure' => function($entry){
                    return date('d.M.Y', $entry->birthdate);
                }
            ],
            [
                'label' => 'Contact phone',
                'name'  => 'contact_phone',
            ],
            [
                'label' => 'Contact email',
                'name'  => 'contact_email',
            ],
            [
                'label' => 'Address',
                'name'  => 'address.name',
                'visible' => function($entry){
                    return !!$entry->address;
                }
            ],
        ],
    ])->to('after_content');
}
```

#### Relation table

[](#relation-table)

`hasMany`

```
protected function setupShowOperation()
{
    Widget::add([
        'type'           => 'relation_table',
        'name'           => 'order_cargos',
        'label'          => 'Order cargo list',
        'backpack_crud'  => 'ordercargo',
        'visible' => function($entry){
            return $entry->order_cargos->count() > 0;
        },
        'search' => function ($query, $search) {
            return $query->where('name', 'like', "%{$search}%");
        },
        'relation_attribute' => 'order_id',
        'button_create' => true,
        'button_delete' => false,
        'columns' => [
            [
                'label' => 'Type',
                'name'  => 'order_cargo_type.name',
            ],
            [
                'label' => 'Weight',
                'name'  => 'weight',
            ],
            [
                'label' => 'Value, $',
                'closure' => function($entry){
                    return "{$entry->value}$";
                }
            ],
        ],
    ])->to('after_content');
}
```

### How to enable creating related model

[](#how-to-enable-creating-related-model)

You need to set:

- `button_create` =&gt; `true`
- `relation_attribute` =&gt; `attribute_name`

Next you need to add to relation/select field `default` value:

```
    CRUD::addField([
        'type' => "relationship",
        'name' => 'order',
        'default' => $_GET['order_id'] ?? null
    ]);
```

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 86% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~64 days

Recently: every ~143 days

Total

18

Last Release

1098d ago

Major Versions

1.9 → 2.02020-12-26

2.1 → 3.02021-11-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/0d4a3945b13adc2ef1e9d7ef3a41c66e28706ae3229b85fc3696114eea990a46?d=identicon)[izica](/maintainers/izica)

---

Top Contributors

[![izica](https://avatars.githubusercontent.com/u/13401922?v=4)](https://github.com/izica "izica (37 commits)")[![egyjs](https://avatars.githubusercontent.com/u/12745270?v=4)](https://github.com/egyjs "egyjs (1 commits)")[![cserepesmark](https://avatars.githubusercontent.com/u/44177367?v=4)](https://github.com/cserepesmark "cserepesmark (1 commits)")[![Oxicode](https://avatars.githubusercontent.com/u/1320709?v=4)](https://github.com/Oxicode "Oxicode (1 commits)")[![promatik](https://avatars.githubusercontent.com/u/1838187?v=4)](https://github.com/promatik "promatik (1 commits)")[![vonsogt](https://avatars.githubusercontent.com/u/35516476?v=4)](https://github.com/vonsogt "vonsogt (1 commits)")[![KevinCassier](https://avatars.githubusercontent.com/u/537986?v=4)](https://github.com/KevinCassier "KevinCassier (1 commits)")

---

Tags

backpacklaravellaravel-backpacklaravel-packagephpphp-librarypluginlaravelwidgetwidgetsrelationsaddonadmin-panelbackpacklaravel backpackBackpack for Laravel

### Embed Badge

![Health badge](/badges/izica-relations-widgets-for-backpack/health.svg)

```
[![Health](https://phpackages.com/badges/izica-relations-widgets-for-backpack/health.svg)](https://phpackages.com/packages/izica-relations-widgets-for-backpack)
```

###  Alternatives

[ziming/json-field-for-backpack

A Json Editor Field for Backpack

35103.7k](/packages/ziming-json-field-for-backpack)[backpack/langfilemanager

An interface to edit language files, for Laravel Backpack.

90234.4k1](/packages/backpack-langfilemanager)[digitallyhappy/toggle-field-for-backpack

Easily toggle boolean attributes with a new field type.

2139.8k](/packages/digitallyhappy-toggle-field-for-backpack)[backpack/revise-operation

Backpack interface for venturecraft/revisionable

43301.7k1](/packages/backpack-revise-operation)[backpack/pagemanager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\\CRUD.

376543.9k6](/packages/backpack-pagemanager)[backpack/backupmanager

Admin interface for managing backups in Backpack, on Laravel 5.2+

336391.2k2](/packages/backpack-backupmanager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
