| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace App\Http\Controllers;
- use App\CustomerLog;
- use Illuminate\Http\Request;
- use App\Http\Controllers\Controller;
- class CustomerLogsController extends Controller
- {
- public function __construct()
- {
- $this->middleware('auth', ['except' => ['index', 'show']]);
- }
- public function index()
- {
- $customer_logs = CustomerLog::paginate();
- return view('customer_logs.index', compact('customer_logs'));
- }
- public function show(CustomerLog $customer_log)
- {
- return view('customer_logs.show', compact('customer_log'));
- }
- public function create(CustomerLog $customer_log)
- {
- return view('customer_logs.create_and_edit', compact('customer_log'));
- }
- public function store($request)
- {
- $customer_log = CustomerLog::create($request->all());
- return redirect()->route('customer_logs.show', $customer_log->id)->with('message', 'Created successfully.');
- }
- public function edit(CustomerLog $customer_log)
- {
- $this->authorize('update', $customer_log);
- return view('customer_logs.create_and_edit', compact('customer_log'));
- }
- public function update($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.');
- }
- }
|