/**
  * Display a listing of reportgroupings
  *
  * @return Response
  */
 public function index($report_id)
 {
     if (!ReportGrouping::canList()) {
         return $this->_access_denied();
     }
     if (Request::ajax()) {
         $users_under_me = Auth::user()->getAuthorizedUserids(ReportGrouping::$show_authorize_flag);
         if (empty($users_under_me)) {
             $reportgroupings = ReportGrouping::whereNotNull('report_groupings.created_at');
         } else {
             $reportgroupings = ReportGrouping::whereIn('report_groupings.user_id', $users_under_me);
         }
         $reportgroupings->where('report_id', $report_id);
         $reportgroupings = $reportgroupings->select(['report_groupings.id', 'report_groupings.name', 'report_groupings.label', 'report_groupings.id as actions']);
         return Datatables::of($reportgroupings)->edit_column('actions', function ($reportgrouping) use($report_id) {
             $actions = [];
             $actions[] = $reportgrouping->canShow() ? link_to_action('ReportGroupingsController@show', 'Show', [$report_id, $reportgrouping->id], ['class' => 'btn btn-xs btn-primary']) : '';
             $actions[] = $reportgrouping->canUpdate() ? link_to_action('ReportGroupingsController@edit', 'Update', [$report_id, $reportgrouping->id], ['class' => 'btn btn-xs btn-default']) : '';
             $actions[] = $reportgrouping->canDelete() ? Former::open(action('ReportGroupingsController@destroy', [$report_id, $reportgrouping->id]))->class('form-inline') . Former::hidden('_method', 'DELETE') . '<button type="button" class="btn btn-xs btn-danger confirm-delete">Delete</button>' . Former::close() : '';
             return implode(' ', $actions);
         })->remove_column('id')->make();
         return Datatables::of($reportgroupings)->make();
     }
     Asset::push('js', 'datatables');
     return View::make('reportgroupings.index', compact('report_id'));
 }