Fix typo
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables\Botanic;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Botanic\Family;
|
||||
|
||||
class FamiliesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Families';
|
||||
|
||||
public function query(Family $model)
|
||||
{
|
||||
$model = $model::withCount('genres');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('alias'),
|
||||
Column::make('latin'),
|
||||
Column::make('genres_count')->title('Nb genres'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->searchable(false)
|
||||
->width(120)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables\Botanic;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Botanic\Genre;
|
||||
|
||||
class GenresDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Genres';
|
||||
|
||||
public function query(Genre $model)
|
||||
{
|
||||
$model = $model::with('family')->withCount('species');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('alias'),
|
||||
Column::make('latin'),
|
||||
Column::make('family.name'),
|
||||
Column::make('species_count')->title('Nb Espèces')->searchable(false),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(120)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables\Botanic;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Botanic\Specie;
|
||||
|
||||
class SpeciesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Species';
|
||||
|
||||
public function query(Specie $model)
|
||||
{
|
||||
$model = $model::withCount('varieties')->with('genre');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('alias'),
|
||||
Column::make('genre.name'),
|
||||
Column::make('latin'),
|
||||
Column::make('varieties_count')->title('Nb variétés')->searchable(false),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(120)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables\Botanic;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Botanic\Variety;
|
||||
|
||||
class VarietiesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Varieties';
|
||||
|
||||
public function query(Variety $model)
|
||||
{
|
||||
$model = $model::with('specie');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('specie_name')->title('Espèce'),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(120)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables;
|
||||
|
||||
use Yajra\DataTables\Html\Button;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use Yajra\DataTables\Html\Editor\Editor;
|
||||
use Yajra\DataTables\Html\Editor\Fields;
|
||||
use Yajra\DataTables\Services\DataTable;
|
||||
|
||||
class ParentDataTable extends DataTable
|
||||
{
|
||||
/**
|
||||
* Build DataTable class.
|
||||
*
|
||||
* @param mixed $query Results from query() method.
|
||||
* @return \Yajra\DataTables\DataTableAbstract
|
||||
*/
|
||||
public function dataTable($query)
|
||||
{
|
||||
$datatables = datatables()->eloquent($query);
|
||||
return self::addButtons($datatables);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add buttons DataTable class.
|
||||
*
|
||||
* @param mixed $query Results from query() method.
|
||||
* @return \Yajra\DataTables\DataTableAbstract
|
||||
*/
|
||||
public function addButtons($datatables)
|
||||
{
|
||||
$buttons = self::getHtmlButtons();
|
||||
return $datatables->addColumn('action', $buttons);
|
||||
}
|
||||
|
||||
public function getHtmlButtons()
|
||||
{
|
||||
$buttons = '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-secondary btn-show mr-2"><i class="fa fa-fw fa-eye"></i></button>';
|
||||
$buttons .= '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-primary btn-edit mr-2"><i class="fa fa-fw fa-edit"></i></button>';
|
||||
$buttons .= '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-danger btn-del"><i class="fa fa-fw fa-trash"></i></button>';
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get query source of dataTable.
|
||||
*
|
||||
* @param \App\Family $model
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function buildQuery($model)
|
||||
{
|
||||
return $model->newQuery();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Optional method if you want to use html builder.
|
||||
*
|
||||
* @return \Yajra\DataTables\Html\Builder
|
||||
*/
|
||||
public function html()
|
||||
{
|
||||
return self::buildHtml(strtolower($this->model_name) . '-table');
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional method if you want to use html builder.
|
||||
*
|
||||
* @return \Yajra\DataTables\Html\Builder
|
||||
*/
|
||||
public function buildHtml($id)
|
||||
{
|
||||
return $this->builder()
|
||||
->setTableId($id)
|
||||
->columns($this->getColumns())
|
||||
->minifiedAjax()
|
||||
->dom('Bfrtip')
|
||||
->orderBy(0,'asc')
|
||||
->buttons(
|
||||
Button::make('export'),
|
||||
Button::make('print')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get filename for export.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function filename()
|
||||
{
|
||||
return self::buildFilename($this->model_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get filename for export.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function buildFilename($models_name)
|
||||
{
|
||||
return $models_name . '_' . date('YmdHis');
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Article;
|
||||
|
||||
class ArticlesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Articles';
|
||||
|
||||
public function query(Article $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::make('alias'),
|
||||
Column::make('latin'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(60)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Category;
|
||||
|
||||
class CategoriesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Categories';
|
||||
|
||||
public function query(Category $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(120)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Customer;
|
||||
|
||||
class CustomersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Customers';
|
||||
|
||||
public function query(Product $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(60)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Invoice;
|
||||
|
||||
class InvoicesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Invoices';
|
||||
|
||||
public function query(Product $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(60)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Order;
|
||||
|
||||
class OrdersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Orders';
|
||||
|
||||
public function query(Product $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(60)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user