mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-13 00:54:07 -08:00
934afa036f
Shift automatically applies the Laravel coding style - which uses the PSR-2 coding style as a base with some minor additions. You may customize the adopted coding style by adding your own [PHP CS Fixer][1] `.php_cs` config file to your project root. Feel free to use [Shift's Laravel ruleset][2] to help you get started. [1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer [2]: https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200
120 lines
3.6 KiB
PHP
120 lines
3.6 KiB
PHP
<?php
|
|
|
|
namespace App\Presenters;
|
|
|
|
/**
|
|
* Class CategoryPresenter
|
|
*/
|
|
class CategoryPresenter extends Presenter
|
|
{
|
|
/**
|
|
* 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,
|
|
'formatter' => 'categoriesLinkFormatter',
|
|
], [
|
|
'field' => 'image',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'title' => trans('general.image'),
|
|
'visible' => true,
|
|
'formatter' => 'imageFormatter',
|
|
], [
|
|
'field' => 'category_type',
|
|
'searchable' => true,
|
|
'sortable' => true,
|
|
'title' => trans('general.type'),
|
|
'visible' => true,
|
|
], [
|
|
'field' => 'item_count',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'title' => trans('general.qty'),
|
|
'visible' => true,
|
|
], [
|
|
'field' => 'has_eula',
|
|
'searchable' => false,
|
|
'sortable' => false,
|
|
'title' => trans('admin/categories/table.eula_text'),
|
|
'visible' => false,
|
|
'formatter' => 'trueFalseFormatter',
|
|
], [
|
|
'field' => 'checkin_email',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'class' => 'css-envelope',
|
|
'title' => 'Send Email',
|
|
'visible' => true,
|
|
'formatter' => 'trueFalseFormatter',
|
|
], [
|
|
'field' => 'require_acceptance',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'title' => trans('admin/categories/table.require_acceptance'),
|
|
'visible' => true,
|
|
'formatter' => 'trueFalseFormatter',
|
|
], [
|
|
'field' => 'actions',
|
|
'searchable' => false,
|
|
'sortable' => false,
|
|
'switchable' => false,
|
|
'title' => trans('table.actions'),
|
|
'visible' => true,
|
|
'formatter' => 'categoriesActionsFormatter',
|
|
],
|
|
[
|
|
'field' => 'created_at',
|
|
'searchable' => true,
|
|
'sortable' => true,
|
|
'visible' => false,
|
|
'title' => trans('general.created_at'),
|
|
'formatter' => 'dateDisplayFormatter',
|
|
],
|
|
[
|
|
'field' => 'updated_at',
|
|
'searchable' => true,
|
|
'sortable' => true,
|
|
'visible' => false,
|
|
'title' => trans('general.updated_at'),
|
|
'formatter' => 'dateDisplayFormatter',
|
|
],
|
|
];
|
|
|
|
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);
|
|
}
|
|
}
|