承接 aayaresko/laravel-table 相关项目开发

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

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

aayaresko/laravel-table

Composer 安装命令:

composer require aayaresko/laravel-table

包简介

Simple HTML table builder for laravel 5

README 文档

README

HTML table builder for laravel 5

Installation

The preferred way to install extension is via composer. Check the composer.json for this extension's requirements and dependencies. To install, either run

$ php composer.phar require aayaresko/laravel-table

or add

"aayaresko/laravel-table": "^1.0"

to the require section of your composer.json.

Configuration

It does not require any additional configuration.

Usage

Simply create a new instance of TablesFacade and pass to it all required parameters:

$table = new TablesFacade($data_provider, $attributes, $default_actions_route);

$data_provider is used as a models source. It should be either an instance of Illuminate\Contracts\Pagination\LengthAwarePaginator or Illuminate\Database\Eloquent\Collection.

$attributes array holds list of attributes, that should be rendered in each table row. You can use 'dot' syntax to target attribute value of related models:

$table = new TablesFacade(
    $data_provider, 
    [
        'nickname',
        'email',
        'profile.full_name',
        'created',        
    ], 
    $default_actions_route
);

In your view you should place something like this:

<div class="table-responsive">
    {{ $table->renderTable() }}
    {{ $table->renderLinks() }}
</div>

You scan use renderLinks() method only when you use Illuminate\Contracts\Pagination\LengthAwarePaginator as $data_provider.

You can specify custom column name for any attribute:

$table = new TablesFacade(
    $data_provider, 
    [
        'Alias' => 'nickname',
        'email',
        'Full name' => 'profile.full_name',
    ], 
    $default_actions_route
);

That custom name will be translated automatically.

You can attach a callback to render any attribute value:

$table = new TablesFacade(
    $data_provider, 
    [
        'nickname',
        'email',
        'profile.full_name',
        'created',   
        'alias' => function ($model) {
            return $model->alias;
        }
    ], 
    $default_actions_route
);

Function signature is pretty straightforward: function ($model) {}.

$default_actions_route is route which will be used as 'parent' to generate links for all action buttons. You can set <$default_actions_route to 'false'.

You can configure your own list of action buttons via $action_buttons property.

'show' => [
    'title' => '<i class="glyphicon glyphicon-eye-open"></i>',
    'route' => 'backend.accounts',
],
'edit' => [
    'title' => '<i class="glyphicon glyphicon-pencil"></i>',
    'route' => 'frontend.accounts',
],
'destroy' => [
    'title' => 'My button content',
    'url' => 'backend/accounts/destroy'
    'options' => [
        'class' => 'delete-ajax',
    ]
]

Please be aware that route and url options are mutually exclusive. You can remove $action_buttons column by setting 'false' as $action_buttons value. You can specify any html options for any button via button options array.

You can specify attributes values for the table itself, tr and td tags of the table via $table_options, $row_options and $item_options respectively. You can specify text, which will be displayed in case of no models via $not_found_text.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-10-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固