0
votes
<?php
        namespace App\Http\Controllers;
        use Illuminate\Http\Request;
        use App\Http\Controllers\customer;
        use App\Http\Requests;

        class CustomerController extends Controller
        {
        public function index()
        {
        return view('insert');
        }
        public function create()
        {

        }
        public function store(Request $request)
        {

        $customer = new customer;
        $customer->name = $request->name;
        $customer->sex = $request->sex;
        $customer->pob = $request->pob;
        $customer->tel = $request->tel;
        $customer->email = $request->email;
        $customer->save();
        }


         public function show()
           {

        return view('show');


           }
        }
?>

I m getting error as Class 'App\Http\Controllers\customer' not found Laravel 5.2.
I have use App\customer; use Inputs; Why am I getting error ? What is the problem in the code?

2

2 Answers

2
votes

If your customer class is in App namespace, you need to use:

use App\customer;

instead of

use App\Http\Controllers\customer;
0
votes

This is simple You need to understand. Make sure you have created a model Customer.php in app/Customer.php and another important thing you must create your table with customers that's all. After that you need to add this line before class like:-

use App\Customer;

Hope it helps :)