mobytes / htmlext
There is no license information available for the latest version (v0.91) of this package.
v0.91
2015-09-05 22:44 UTC
Requires
- php: >=5.4.0
- illuminate/support: 4.2.*
This package is not auto-updated.
Last update: 2024-11-10 01:44:21 UTC
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