| Server IP : 139.59.63.204 / Your IP : 216.73.217.62 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ubuntu-s-1vcpu-1gb-blr1-01 6.8.0-110-generic #110-Ubuntu SMP PREEMPT_DYNAMIC Thu Mar 19 15:09:20 UTC 2026 x86_64 User : root ( 0) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/crmapp/app/Http/Controllers/ |
Upload File : |
<?php
namespace App\Http\Controllers;
use App\Models\Customer;
use App\Models\User;
use Illuminate\Http\Request;
class CustomerController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$customers = Customer::with('user')->paginate(10);
return view('customers.index', compact('customers'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$users = User::all();
return view('customers.create', compact('users'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$request->validate([
'name' => 'required|string|max:255',
'email' => 'nullable|email',
'phone' => 'nullable|string',
]);
Customer::create($request->all());
return redirect()->route('customers.index')->with('success', 'Customer created successfully');
}
/**
* Display the specified resource.
*/
public function show(Customer $customer)
{
return view('customers.show', compact('customer'));
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}