Skip to content

Instantly share code, notes, and snippets.

@abishekrsrikaanth
Created March 9, 2020 12:11
Show Gist options
  • Select an option

  • Save abishekrsrikaanth/260db18d3c46d422536a013262f035d2 to your computer and use it in GitHub Desktop.

Select an option

Save abishekrsrikaanth/260db18d3c46d422536a013262f035d2 to your computer and use it in GitHub Desktop.
<?php
namespace Workdoneright\GroupByTool;
use Laravel\Nova\ResourceTool;
class GroupByTool extends ResourceTool
{
/**
* Get the displayable name of the resource tool.
*
* @return string
*/
public function name()
{
return 'Group_By_Tool';
}
/**
* Get the component name for the resource tool.
*
* @return string
*/
public function component()
{
return 'group_by_tool';
}
public function setTitle($title)
{
$this->withMeta(['title' => $title]);
return $this;
}
public function usingModel(string $model)
{
$this->withMeta(['model' => $model]);
return $this;
}
public function groupBy($columns = [])
{
$this->withMeta(['group_by' => $columns]);
return $this;
}
public function selectColumns($columns = [])
{
$this->withMeta(['select_columns' => $columns]);
return $this;
}
public function usingWhereCondition($data)
{
$this->withMeta(['using_where' => $data]);
return $this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment