2016-12-23 17:52:00 -08:00
|
|
|
<?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'),
|
2017-03-11 05:30:14 -08:00
|
|
|
"visible" => true,
|
2017-02-16 00:32:33 -08:00
|
|
|
"formatter" => 'categoriesLinkFormatter',
|
2017-10-25 22:35:58 -07:00
|
|
|
],[
|
|
|
|
"field" => "image",
|
|
|
|
"searchable" => false,
|
|
|
|
"sortable" => true,
|
|
|
|
"title" => trans('general.image'),
|
|
|
|
"visible" => true,
|
|
|
|
"formatter" => 'imageFormatter',
|
2017-02-16 00:32:33 -08:00
|
|
|
],[
|
2017-11-21 20:33:30 -08:00
|
|
|
"field" => "category_type",
|
2017-02-16 00:32:33 -08:00
|
|
|
"searchable" => true,
|
|
|
|
"sortable" => true,
|
|
|
|
"title" => trans('general.type'),
|
|
|
|
"visible" => true
|
2020-05-23 10:36:02 -07:00
|
|
|
],[
|
|
|
|
"field" => "item_count",
|
2018-05-04 21:01:38 -07:00
|
|
|
"searchable" => false,
|
|
|
|
"sortable" => true,
|
2020-05-23 10:36:02 -07:00
|
|
|
"title" => trans('general.qty'),
|
2018-05-04 21:01:38 -07:00
|
|
|
"visible" => true
|
2020-05-23 10:36:02 -07:00
|
|
|
],[
|
2017-10-11 14:44:25 -07: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',
|
2020-05-23 10:36:02 -07:00
|
|
|
],[
|
2017-02-16 00:32:33 -08:00
|
|
|
"field" => "require_acceptance",
|
|
|
|
"searchable" => false,
|
2017-10-19 11:44:42 -07:00
|
|
|
"sortable" => true,
|
2017-02-16 00:32:33 -08:00
|
|
|
"title" => trans('admin/categories/table.require_acceptance'),
|
2017-03-11 05:30:14 -08:00
|
|
|
"visible" => true,
|
2017-02-16 00:32:33 -08:00
|
|
|
"formatter" => 'trueFalseFormatter',
|
2020-05-23 10:36:02 -07:00
|
|
|
],[
|
2017-02-16 00:32:33 -08:00
|
|
|
"field" => "actions",
|
|
|
|
"searchable" => false,
|
|
|
|
"sortable" => false,
|
|
|
|
"switchable" => false,
|
|
|
|
"title" => trans('table.actions'),
|
2017-03-11 05:30:14 -08:00
|
|
|
"visible" => true,
|
2017-02-16 00:32:33 -08:00
|
|
|
"formatter" => "categoriesActionsFormatter",
|
|
|
|
]
|
|
|
|
];
|
|
|
|
|
|
|
|
return json_encode($layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-12-23 17:52:00 -08:00
|
|
|
/**
|
|
|
|
* Link to this categories name
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function nameUrl()
|
|
|
|
{
|
|
|
|
return (string) link_to_route('categories.show', $this->name, $this->id);
|
|
|
|
}
|
2016-12-26 15:19:04 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Url to view this item.
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function viewUrl()
|
|
|
|
{
|
|
|
|
return route('categories.show', $this->id);
|
|
|
|
}
|
2016-12-23 17:52:00 -08:00
|
|
|
}
|