定制 mobytes/htmlext 二次开发

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

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

mobytes/htmlext

最新稳定版本:v0.91

Composer 安装命令:

composer require mobytes/htmlext

包简介

README 文档

README

Table builder for Laravel 4.2

###Installation

{
    "require": {
        "mobytes/htmlext": "dev-master"
    }
}

run composer update

Then add Service provider to config/app.php

    'providers' => [
        // ...
        'Mobytes\Htmlext\HtmlextServiceProvider'
    ]

And Facade (also in config/app.php)

    'aliases' => [
        // ...
        'TableBuilder'	  => 'Mobytes\Htmlext\Facade\TableBuilder',
    ]

Quick start

Create a class with the table settings

<?php namespace App\Tables;

use Mobytes\Htmlext\Table;

class NoticeTable extends Table
{
    //create text button
    protected $btn_new = "Crear nueva noticia";
    
    //Table title 
    protected $title = "Todas las noticias de cepco.org.pe";
    
    //activate the paginate
    protected $paginate = true;
    
    //number of records per page
    protected $per_page = 7;
    
    //Titles of thead
    protected $thead = array(
        "title" => [
            "Titulo",
            "Subtitulo",
            "Contenido",
            "Tags",
            "Actions"
        ]
    );
    
    //records tbody
    protected $tbody = array(
        "fields" => [
            "titulo" => [
                "class" => ""
            ],
            "subtitulo" => [
                "class" => ""
            ],
            "contenido" => [
                "class" => ""
            ],
            "tags" => [
                "class" => ""
            ]
        ]
     );
    
    //Start function    
    public function build()
    {
        $prefix_router = "landpage.noticias";
        $this->build($prefix_router);
    }
}

After that instantiate the class in the controller and pass it to view:

<?php namespace App/Http/Controllers;

use Illuminate\Routing\Controller as BaseController;
use Mobytes\Htmlext\TableBuilderTrait;

class NoticesController extends BaseController {
    
    // ...
    use TableBuilderTrait;
    
    public function index()
    {
        //notices type Builder
        $notices = $this->publication->getAllByType(self::$_NOTICE);
        
        $table = $this->table('Mobytes\Landpage\Publication\Table\NoticeTable',$notices);
        
        return View::make(Config::get('notices.index'), compact('table'));
    }
}

Print the form in view with table() helper function:

<!-- views/notices/index.blade.php -->

@extend('layouts.master')

@section('content')
    {{ table($table) }}
@endsection

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 5
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-09-05