|
|
@@ -1,69 +0,0 @@
|
|
|
-<?php
|
|
|
-
|
|
|
-namespace App\Http\Controllers;
|
|
|
-
|
|
|
-use App\Customer;
|
|
|
-use App\CustomerLog;
|
|
|
-use App\CustomerLogStatus;
|
|
|
-use Illuminate\Http\RedirectResponse;
|
|
|
-use Illuminate\Http\Request;
|
|
|
-
|
|
|
-class CustomerLogsController extends Controller
|
|
|
-{
|
|
|
- public function __construct()
|
|
|
- {
|
|
|
- $this->middleware('auth');
|
|
|
- }
|
|
|
-
|
|
|
- public function index(Request $request)
|
|
|
- {
|
|
|
- $customer_logs = CustomerLog::query()->with(['customerLogStatus', 'user', 'customer'])->where('id',$request->id) ->orderByDesc('updated_at')->paginate();
|
|
|
- return view('customer.customer_logs.index', compact('customer_logs'));
|
|
|
- }
|
|
|
-
|
|
|
- public function show($customer_log_id)
|
|
|
- {
|
|
|
- $customer_log =CustomerLog::query()->with(['customerLogStatus', 'user', 'customer'])->where('id',$customer_log_id)->first();
|
|
|
- return view('customer.customer_logs.show', compact('customer_log'));
|
|
|
- }
|
|
|
-
|
|
|
- public function create(CustomerLog $customer_log)
|
|
|
- {
|
|
|
- $customers = Customer::all();
|
|
|
- $customerLogStatuses = CustomerLogStatus::all();
|
|
|
- return view('customer.customer_logs.create_and_edit', compact('customer_log', 'customers', 'customerLogStatuses'));
|
|
|
- }
|
|
|
-
|
|
|
- public function store(Request $request): RedirectResponse
|
|
|
- {
|
|
|
- $data = [];
|
|
|
- $data = $request->all();
|
|
|
- $data['user_id'] = auth()->id();
|
|
|
- $customer_log = CustomerLog::create($data);
|
|
|
- return redirect()->route('customer_logs.show', $customer_log->id)->with('message', 'Created successfully.');
|
|
|
- }
|
|
|
-
|
|
|
- public function edit(CustomerLog $customer_log)
|
|
|
- {
|
|
|
- $this->authorize('update', $customer_log);
|
|
|
- $customers = Customer::all();
|
|
|
- $customerLogStatuses = CustomerLogStatus::all();
|
|
|
- return view('customer.customer_logs.create_and_edit', compact('customer_log', 'customers', 'customerLogStatuses'));
|
|
|
- }
|
|
|
-
|
|
|
- public function update(Request $request, CustomerLog $customer_log)
|
|
|
- {
|
|
|
- $this->authorize('update', $customer_log);
|
|
|
- $customer_log->update($request->all());
|
|
|
-
|
|
|
- return redirect()->route('customer_logs.show', $customer_log->id)->with('message', 'Updated successfully.');
|
|
|
- }
|
|
|
-
|
|
|
- public function destroy(CustomerLog $customer_log)
|
|
|
- {
|
|
|
- $this->authorize('destroy', $customer_log);
|
|
|
- $customer_log->delete();
|
|
|
-
|
|
|
- return redirect()->route('customer_logs.index')->with('message', 'Deleted successfully.');
|
|
|
- }
|
|
|
-}
|