middleware('auth'); } public function index(Request $request) { $customerLog = CustomerLog::query()->with(['customerLogStatus', 'user', 'customer'])->where('id',$request->id) ->orderByDesc('updated_at')->paginate(); return view('customer.customerLog.index', compact('customerLog')); } public function show($customerLog_id) { $customerLog =CustomerLog::query()->with(['customerLogStatus', 'user', 'customer'])->where('id',$customerLog_id)->first(); return view('customer.customerLog.show', compact('customerLog')); } public function create(CustomerLog $customerLog) { $customers = Customer::all(); $customerLogStatuses = CustomerLogStatus::all(); return view('customer.customerLog.createAndEdit', compact('customerLog', 'customers', 'customerLogStatuses')); } public function store(Request $request): RedirectResponse { $data = $request->all(); $data['user_id'] = auth()->id(); $customerLog = CustomerLog::query()->create($data); return redirect()->route('customerLog.show', $customerLog->id)->with('message', 'Created successfully.'); } public function edit(CustomerLog $customerLog) { $this->authorize('update', $customerLog); $customers = Customer::all(); $customerLogStatuses = CustomerLogStatus::all(); return view('customer.customerLog.createAndEdit', compact('customerLog', 'customers', 'customerLogStatuses')); } public function update(Request $request, CustomerLog $customerLog) { $this->authorize('update', $customerLog); $customerLog->update($request->all()); return redirect()->route('customerLog.show', $customerLog->id)->with('message', 'Updated successfully.'); } public function destroy(CustomerLog $customerLog) { $this->authorize('destroy', $customerLog); $customerLog->delete(); return redirect()->route('customerLog.index')->with('message', 'Deleted successfully.'); } }