snipe-it/app/Presenters/CategoryPresenter.php
snipe 75b527ab59 Features/image uploads (#4320)
* Locations API support for image

* Added manufacturers API support for image

* Added manufacturers API support for image

* Added image support for locations add/update

* Added manufacturer image upload support to controller

* General image string

* Added blade support for image uploads/delete image

* Added $request support (from Input::)

* Added image support in API transformers

* Added image to Manufacturers presenter for data table

* Migration to create image fields

* Ignore the contents of the new image directories

* Create new image upload directories

* Created components/consumables uploads directory

* Fixed missing textSearch scope from companies

* Added ignore for companies uploads directory

* Added blade support for image upload

* Fixed path to upload directory on edit

* Added company image upport to transformers, controllers

* Added image support for categories

* Added support for images in Departments

* Added support for image in Consumables

* Added image support for components
2017-10-25 22:35:58 -07:00

120 lines
3.5 KiB
PHP

<?php
namespace App\Presenters;
use App\Helpers\Helper;
/**
* Class CategoryPresenter
* @package App\Presenters
*/
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" => "type",
"searchable" => true,
"sortable" => true,
"title" => trans('general.type'),
"visible" => true
], [
"field" => "assets_count",
"searchable" => false,
"sortable" => true,
"title" => trans('general.assets'),
"visible" => true
], [
"field" => "accessories_count",
"searchable" => false,
"sortable" => true,
"title" => trans('general.accessories'),
"visible" => true
], [
"field" => "consumables_count",
"searchable" => false,
"sortable" => true,
"title" => trans('general.consumables'),
"visible" => true
], [
"field" => "components_count",
"searchable" => false,
"sortable" => true,
"title" => trans('general.components'),
"visible" => true
], [
"field" => "eula",
"searchable" => false,
"sortable" => false,
"title" => trans('admin/categories/table.eula_text'),
"visible" => false,
"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",
]
];
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);
}
}