I’m new to Laravel 5. I tried to create Customer
model in my Models folder. I created both CustomerController
and Customer
via php artisan make:...
and now I get the error:
FatalErrorException in CustomerController.php line 30: Class 'App\Http\Controllers\Cusomter' not found.
My Customer
model:
<?php namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Customer extends Model {
//
protected $table = 'Customer';
protected $primaryKey = 'CID';
// protected $fillable = [
// 'Name',
// 'Gender',
// 'Address',
// 'DiscountPercent',
// 'Email',
// 'Phone'
// ];
}
My CustomerController
:
<?php namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Customer;
class CustomerController extends Controller {
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
//
$customers = Customer::all();
return View::make('Customer.home',compact('customers'));
// return View('Customer.home');
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
//
}
}
I dont know what i was doing anything wrong. Is there any help. I also did some search on Internet and i know its about namespace. Is there any ebook or documents for me to understand how namespace works, how to use and do i need to declare before using it
App\Models
) that might be the problem... – lukasgeitercomposer dump-autoload
again after deleting) – lukasgeiter