performing/laravel-view-helpers 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

performing/laravel-view-helpers

最新稳定版本:0.4.7

Composer 安装命令:

composer require performing/laravel-view-helpers

包简介

This is my package laravel-view-helpers

README 文档

README

This package offers some helpers to build common data strucuture and logic in the context of CRUD applications.

Installation

You can install the package via composer:

composer require performing/laravel-view-helpers

You can publish the config file with:

php artisan vendor:publish --tag="laravel-view-helpers-config"

This is the contents of the published config file:

return [
    'table' => [
        'use_filters' => true,

        'default_filters' => [
            Filter::make('Search')
                ->type('text')
                ->on(function ($query, $value) {
                    return $query->search($value);
                })
        ],

        'default_query' => [
            'per_page' => 15,
        ]
    ]
];

Usage

It's basically headless so it gives you just the data in the right format to build simple tables and forms. You will need to build all the query and filter logic.

Instead of using Inertia::render to return the components data we use Performing\View\Page::class.

class PostController
{
    public function index(Request $request)
    {
        return Page::make('Posts')
            ->table(fn (Table $table) => $table
                ->rows(
                    Post::query()->latest(),
                    PostResource::class
                )
                ->columns([
                    Column::make('ID')->sortable(),
                    Column::make('Title', 'title')->sortable(),
                    Column::make('Azioni')->component(ColumnType::Actions)->sortable(),
                ])
            )->form([
                Input::make('Text'),
                Input::make('Password')->type('password'),
                Input::make('Dropdown')->type('select')->options([ 1 => 'one', 2 => 'two']),
                Input::make('Message')->type('textarea'),
            ])
            ->render('Posts/Index');
    }
}

Testing

composer test

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-15