Report page cache own widget..
This commit is contained in:
@ -142,7 +142,7 @@ abstract class Report
|
||||
$sum += is_array($total) ? array_sum($total) : $total;
|
||||
}
|
||||
|
||||
$total = money($sum, setting('default.currency'), true);
|
||||
$total = money($sum, setting('default.currency'), true)->format();
|
||||
} else {
|
||||
$total = trans('general.na');
|
||||
}
|
||||
|
@ -67,6 +67,8 @@ class ReportReminder extends Command
|
||||
|
||||
$ttl = 3600 * 6; // 6 hours
|
||||
|
||||
Cache::forget('reports.totals.' . $report->id);
|
||||
|
||||
Cache::remember('reports.totals.' . $report->id, $ttl, function () use ($class) {
|
||||
return $class->getGrandTotal();
|
||||
});
|
||||
|
@ -24,6 +24,7 @@ class Reports extends Controller
|
||||
$this->middleware('permission:update-common-reports')->only('edit', 'update', 'enable', 'disable');
|
||||
$this->middleware('permission:delete-common-reports')->only('destroy');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
@ -271,16 +272,17 @@ class Reports extends Controller
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function clear()
|
||||
public function clear(Report $report)
|
||||
{
|
||||
Report::all()->each(function ($report) {
|
||||
if (!Utility::canShow($report->class)) {
|
||||
return;
|
||||
}
|
||||
$data = Utility::getClassInstance($report)->getGrandTotal();
|
||||
|
||||
Cache::put('reports.totals.' . $report->id, Utility::getClassInstance($report)->getGrandTotal());
|
||||
});
|
||||
Cache::put('reports.totals.' . $report->id, $data);
|
||||
|
||||
return redirect()->back();
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'data' => $data,
|
||||
'message' => '',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user