¨4.0.1¨
This commit is contained in:
@@ -4,6 +4,7 @@ namespace Modules\Report\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Report\TaxReport;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Report\SalesReport;
|
||||
use Modules\Report\SearchReport;
|
||||
use Modules\Report\CouponsReport;
|
||||
@@ -40,27 +41,31 @@ class ReportController
|
||||
'tax_report' => TaxReport::class,
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$type = $request->query('type');
|
||||
|
||||
if (! $this->reportTypeExists($type)) {
|
||||
if (!$this->reportTypeExists($type)) {
|
||||
return redirect()->route('admin.reports.index', ['type' => 'coupons_report']);
|
||||
}
|
||||
|
||||
return $this->report($type)->render($request);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine if the report type exists.
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function reportTypeExists($type)
|
||||
@@ -68,10 +73,12 @@ class ReportController
|
||||
return array_key_exists($type, $this->reports);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a new instance of the given type of report.
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private function report($type)
|
||||
|
||||
Reference in New Issue
Block a user