![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/inventory.corals.io/Corals/modules/Inventory/Http/Controllers/ |
<?php namespace Corals\Modules\Inventory\Http\Controllers; use Corals\Foundation\Http\Controllers\BaseController; use Corals\Modules\Inventory\DataTables\CustomersDataTable; use Corals\Modules\Inventory\DataTables\OrdersDataTable; use Corals\Modules\Inventory\DataTables\scopes; use Corals\Modules\Inventory\Http\Requests\CustomerRequest; use Corals\Modules\Inventory\Models\Customer; class CustomersController extends BaseController { public function __construct() { $this->setViewSharedData(['hideCreate' => true]); $this->title = trans('Inventory::module.customer.title'); parent::__construct(); } /** * @param CustomersDataTable $dataTable * @return mixed */ public function index(CustomersDataTable $dataTable) { return $dataTable->render('Inventory::customers.index'); } /** * @param CustomerRequest $request * @param Customer $customer * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function show(CustomerRequest $request, Customer $customer) { $this->setViewSharedData([ 'title_singular' => trans('Corals::labels.show_title', ['title' => $customer->getIdentifier()]), 'showModel' => $customer, ]); $dataTable = new OrdersDataTable(); $dataTable->setResourceUrl(route('customerOrders', ['customer' => $customer->hashed_id])); return view('Inventory::customers.show')->with(compact('customer', 'dataTable')); } public function customerOrders(CustomerRequest $request, Customer $customer, OrdersDataTable $dataTable) { $dataTable->addScope(new scopes\CustomerOrderScope($customer)); return $dataTable->renderAjaxAndActions(); } public function customerFullReport(CustomerRequest $request, Customer $customer) { $this->setViewSharedData([ 'title_singular' => $customer->full_name, 'showModel' => $customer, ]); if ($request->has('print')) { $datesForReports = $request->all(); return view('Inventory::customers.customerReportForPrint')->with(compact('customer', 'datesForReports')); } else { return view('Inventory::customers.customer_report')->with(compact('customer')); } } }