承接 rizkhal/inertable 相关项目开发

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

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

rizkhal/inertable

Composer 安装命令:

composer require rizkhal/inertable

包简介

A simple datatable for inertia

README 文档

README

Package Logo

GitHub last commit GitHub cs fixer GitHub last commit GitHub issues Packagist Version Packagist Downloads

INSTALATION

composer require rizkhal/inertable

USAGE

php artisan make:inertable UserTable
<?php

declare(strict_types=1);

namespace App\Inertable;

use App\Models\User;
use Rizkhal\Inertable\Column;
use Illuminate\Support\Carbon;
use Rizkhal\Inertable\Inertable;
use Illuminate\Database\Eloquent\Builder;

class UserTable extends Inertable
{
    public function query(): Builder
    {
        return User::query();
    }

    public function columns(): array
    {
        return [
            Column::checkbox(),
            Column::make(__('Name'), 'name')->sortable()->searchable(),
            Column::make(__('Email'), 'email')->sortable()->searchable(),
            Column::make(__('Verified'), 'email_verified_at')->sortable()->searchable()->format(fn (Carbon $value): string => $value->format('d/m/Y')),
            Column::make(__('status'), 'status')->sortable()->searchable(),
            Column::action(),
        ];
    }
}

Add hidden response

protected $hiddens = [
    'office'
];

The response will include office object in response to inertable props.

Hidden response also accept relatoin, for example if you have HasMany relation from user to posts

protected $hiddens = [
    'user.posts'
];

That's will return hidden user posts inside inertable props.

Usage inside controller

You can use this with reactjs, svelte or vue with inertajs

public function __invoke() {
    return inertia('/path/to/file.{vue|jsx|svelte}')->inertable(new UserTable());
}

Response example

Click view
{
  "columns": [
    {
      "na": false,
      "blank": false,
      "sortable": true,
      "searchable": true,
      "checkbox": false,
      "sortCallback": null,
      "searchCallback": null,
      "formatCallback": null,
      "text": "name",
      "column": "name"
    },
    {
      "na": false,
      "blank": false,
      "sortable": true,
      "searchable": true,
      "checkbox": false,
      "sortCallback": null,
      "searchCallback": null,
      "formatCallback": null,
      "text": "email",
      "column": "email"
    },
    {
      "na": false,
      "blank": false,
      "sortable": true,
      "searchable": false,
      "checkbox": false,
      "sortCallback": null,
      "searchCallback": null,
      "formatCallback": {},
      "text": "email_verified_at",
      "column": "email_verified_at"
    },
    {
      "na": false,
      "blank": false,
      "sortable": true,
      "searchable": false,
      "checkbox": false,
      "sortCallback": null,
      "searchCallback": null,
      "formatCallback": {},
      "text": "created_at",
      "column": "created_at"
    }
  ],
  "data": {
    "current_page": 1,
    "data": [
      {
        "id": 1,
        "name": "Robbie Abernathy",
        "email": "nyundt@example.com",
        "email_verified_at": "18/10/2022",
        "created_at": "18/10/2022"
      },
      {
        "id": 2,
        "name": "Alfredo Langworth",
        "email": "sofia.krajcik@example.com",
        "email_verified_at": "18/10/2022",
        "created_at": "18/10/2022"
      },
      {
        "id": 3,
        "name": "Deron Carroll",
        "email": "considine.jevon@example.net",
        "email_verified_at": "18/10/2022",
        "created_at": "18/10/2022"
      },
      {
        "id": 4,
        "name": "Mr. Geoffrey Ritchie Sr.",
        "email": "baumbach.alysha@example.net",
        "email_verified_at": "18/10/2022",
        "created_at": "18/10/2022"
      },
      {
        "id": 5,
        "name": "Miss Beth Kirlin IV",
        "email": "mauricio.abernathy@example.net",
        "email_verified_at": "18/10/2022",
        "created_at": "18/10/2022"
      },
      {
        "id": 6,
        "name": "Davon Huel MD",
        "email": "orland78@example.net",
        "email_verified_at": "18/10/2022",
        "created_at": "18/10/2022"
      },
      {
        "id": 7,
        "name": "Colleen Welch",
        "email": "mertz.chad@example.com",
        "email_verified_at": "18/10/2022",
        "created_at": "18/10/2022"
      },
      {
        "id": 8,
        "name": "Alvah Crona",
        "email": "albert78@example.org",
        "email_verified_at": "18/10/2022",
        "created_at": "18/10/2022"
      },
      {
        "id": 9,
        "name": "Verlie Streich",
        "email": "lubowitz.mckayla@example.com",
        "email_verified_at": "18/10/2022",
        "created_at": "18/10/2022"
      },
      {
        "id": 10,
        "name": "Ms. Kristy Yost",
        "email": "sauer.justina@example.org",
        "email_verified_at": "18/10/2022",
        "created_at": "18/10/2022"
      },
      {
        "id": 11,
        "name": "Jazmyn Blick",
        "email": "corkery.nella@example.net",
        "email_verified_at": "18/10/2022",
        "created_at": "18/10/2022"
      },
      {
        "id": 12,
        "name": "Dr. Hyman Hauck",
        "email": "tvonrueden@example.net",
        "email_verified_at": "18/10/2022",
        "created_at": "18/10/2022"
      },
      {
        "id": 13,
        "name": "Miss Heather Ernser DDS",
        "email": "kozey.dana@example.com",
        "email_verified_at": "18/10/2022",
        "created_at": "18/10/2022"
      },
      {
        "id": 14,
        "name": "Jovan Kiehn Jr.",
        "email": "bette.barton@example.org",
        "email_verified_at": "18/10/2022",
        "created_at": "18/10/2022"
      },
      {
        "id": 15,
        "name": "Mr. Florencio Huel",
        "email": "greynolds@example.com",
        "email_verified_at": "18/10/2022",
        "created_at": "18/10/2022"
      }
    ],
    "first_page_url": "http://example.test/users?page=1",
    "from": 1,
    "last_page": 134,
    "last_page_url": "http://example.test/users?page=134",
    "links": [
      {
        "url": null,
        "label": "&laquo; Previous",
        "active": false
      },
      {
        "url": "http://example.test/users?page=1",
        "label": "1",
        "active": true
      },
      {
        "url": "http://example.test/users?page=2",
        "label": "2",
        "active": false
      },
      {
        "url": "http://example.test/users?page=3",
        "label": "3",
        "active": false
      },
      {
        "url": "http://example.test/users?page=4",
        "label": "4",
        "active": false
      },
      {
        "url": "http://example.test/users?page=5",
        "label": "5",
        "active": false
      },
      {
        "url": "http://example.test/users?page=6",
        "label": "6",
        "active": false
      },
      {
        "url": "http://example.test/users?page=7",
        "label": "7",
        "active": false
      },
      {
        "url": "http://example.test/users?page=8",
        "label": "8",
        "active": false
      },
      {
        "url": "http://example.test/users?page=9",
        "label": "9",
        "active": false
      },
      {
        "url": "http://example.test/users?page=10",
        "label": "10",
        "active": false
      },
      {
        "url": null,
        "label": "...",
        "active": false
      },
      {
        "url": "http://example.test/users?page=133",
        "label": "133",
        "active": false
      },
      {
        "url": "http://example.test/users?page=134",
        "label": "134",
        "active": false
      },
      {
        "url": "http://example.test/users?page=2",
        "label": "Next &raquo;",
        "active": false
      }
    ],
    "next_page_url": "http://example.test/users?page=2",
    "path": "http://example.test/users",
    "per_page": 15,
    "prev_page_url": null,
    "to": 15,
    "total": 2000
  },
  "filters": {
    "column": null,
    "search": null,
    "direction": null,
    "filters": null,
    "perpage": null
  }
}

rizkhal/inertable 适用场景与选型建议

rizkhal/inertable 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 675 次下载、GitHub Stars 达 15, 最近一次更新时间为 2022 年 02 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 rizkhal/inertable 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 rizkhal/inertable 我们能提供哪些服务?
定制开发 / 二次开发

基于 rizkhal/inertable 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 15
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-23