duplicate report

This commit is contained in:
denisdulici
2020-01-26 02:21:34 +03:00
parent daf46b843a
commit bb12d411df
5 changed files with 28 additions and 2 deletions

View File

@ -22,7 +22,7 @@ class Reports extends Controller
{
$totals = $icons = $categories = [];
$reports = Report::all();
$reports = Report::orderBy('name')->get();
foreach ($reports as $report) {
if (!Utility::canRead($report->class)) {
@ -103,6 +103,24 @@ class Reports extends Controller
return response()->json($response);
}
/**
* Duplicate the specified resource.
*
* @param Report $report
*
* @return Response
*/
public function duplicate(Report $report)
{
$clone = $report->duplicate();
$message = trans('messages.success.duplicated', ['type' => trans_choice('general.reports', 1)]);
flash($message)->success();
return redirect()->route('reports.edit', $clone->id);
}
/**
* Show the form for editing the specified resource.
*