You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
topnotch_website/app/Http/Controllers/ContactController.php

47 lines
1.3 KiB
PHTML

3 months ago
<?php
namespace App\Http\Controllers;
use App\Http\Requests\ContactRequest;
use App\Models\Contact;
use App\Models\Customer;
2 months ago
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
3 months ago
use Illuminate\Http\Request;
class ContactController extends Controller
{
2 months ago
public function index(): void {}
3 months ago
2 months ago
public function create(Request $request): View
3 months ago
{
return view('contacts.create', [
3 months ago
'customers' => Customer::all(),
3 months ago
'fromCustomer' => $request->get('customer'),
]);
}
2 months ago
public function store(ContactRequest $request): RedirectResponse
3 months ago
{
$contact = Contact::create($request->validated());
return redirect()->route('customers.show', [$contact->customer, 'contacts'])->with('status', 'Contact created successfully');
}
2 months ago
public function show(int $id): void {}
3 months ago
2 months ago
public function edit(int $id): void {}
3 months ago
2 months ago
public function update(Request $request, int $id): void {}
3 months ago
2 months ago
public function requestDestroy(Request $request): RedirectResponse
3 months ago
{
$contact = Contact::find($request->get('contact'));
$contact->delete();
return redirect()->route('customers.show', [$contact->customer->id, 'contacts'])->with('status', 'Contact deleted successfully');
}
2 months ago
public function destroy(int $id): void {}
3 months ago
}