snipe-it/app/Presenters/CategoryPresenter.php

124 lines
3.7 KiB
PHP
Raw Normal View History

<?php
namespace App\Presenters;
/**
* Class CategoryPresenter
* @package App\Presenters
*/
class CategoryPresenter extends Presenter
{
2017-02-16 00:32:33 -08:00
/**
* Json Column Layout for bootstrap table
* @return string
*/
public static function dataTableLayout()
{
$layout = [
[
"field" => "id",
"searchable" => false,
"sortable" => true,
"switchable" => true,
"title" => trans('general.id'),
"visible" => false
], [
"field" => "name",
"searchable" => true,
"sortable" => true,
"title" => trans('general.name'),
"visible" => true,
2017-02-16 00:32:33 -08:00
"formatter" => 'categoriesLinkFormatter',
],[
"field" => "image",
"searchable" => false,
"sortable" => true,
"title" => trans('general.image'),
"visible" => true,
"formatter" => 'imageFormatter',
2017-02-16 00:32:33 -08:00
],[
"field" => "category_type",
2017-02-16 00:32:33 -08:00
"searchable" => true,
"sortable" => true,
"title" => trans('general.type'),
"visible" => true
], [
"field" => "assets_count",
"searchable" => false,
"sortable" => true,
2017-02-16 00:32:33 -08:00
"title" => trans('general.assets'),
"visible" => true
2017-02-16 00:32:33 -08:00
], [
"field" => "accessories_count",
"searchable" => false,
"sortable" => true,
2017-02-16 00:32:33 -08:00
"title" => trans('general.accessories'),
"visible" => true
2017-02-16 00:32:33 -08:00
], [
"field" => "consumables_count",
"searchable" => false,
"sortable" => true,
2017-02-16 00:32:33 -08:00
"title" => trans('general.consumables'),
"visible" => true
], [
"field" => "components_count",
"searchable" => false,
"sortable" => true,
2017-02-16 00:32:33 -08:00
"title" => trans('general.components'),
"visible" => true
2018-05-04 21:01:38 -07:00
], [
"field" => "licenses_count",
"searchable" => false,
"sortable" => true,
"title" => trans('general.licenses'),
"visible" => true
2017-02-16 00:32:33 -08:00
], [
"field" => "eula",
2017-02-16 00:32:33 -08:00
"searchable" => false,
"sortable" => false,
"title" => trans('admin/categories/table.eula_text'),
"visible" => false,
"formatter" => 'trueFalseFormatter',
], [
2017-02-16 00:32:33 -08:00
"field" => "require_acceptance",
"searchable" => false,
"sortable" => true,
2017-02-16 00:32:33 -08:00
"title" => trans('admin/categories/table.require_acceptance'),
"visible" => true,
2017-02-16 00:32:33 -08:00
"formatter" => 'trueFalseFormatter',
],
[
2017-02-16 00:32:33 -08:00
"field" => "actions",
"searchable" => false,
"sortable" => false,
"switchable" => false,
"title" => trans('table.actions'),
"visible" => true,
2017-02-16 00:32:33 -08:00
"formatter" => "categoriesActionsFormatter",
]
];
return json_encode($layout);
}
/**
* Link to this categories name
* @return string
*/
public function nameUrl()
{
return (string) link_to_route('categories.show', $this->name, $this->id);
}
/**
* Url to view this item.
* @return string
*/
public function viewUrl()
{
return route('categories.show', $this->id);
}
}