samedi 24 octobre 2015

Fatal Exception Route::get does not work Laravel 5

I´m trying to get the date from an user in my DDBB, them, I have 2 customer in a table.

The schema is called - customers The table is called - names

And names has two columns, id and name, its very simple. I have added two persons in my table, Tony and Bob.

In laravel, in the app folder, I have created a new php file, and I put this:

<?php

namespace App; 

use Illuminate\Database\Eloquent\Model;

class Customer extends Model{

}

And I have this code in my .env file:

DB_HOST=localhost
DB_DATABASE=customers
DB_USERNAME=root
DB_PASSWORD=root

Then, I just want get my first customer, Tony, and in routes.php I have write this:

Route::get('customer', function(){
    $customer = App\Customer::find(1); 
    print_r($customer); 
});

When I run the application, I get this message:

FatalErrorException in routes.php line 23:
Class 'App\Customer' not found

I would like to get something, but I don´t know what happen. Thanks.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1MZySuQ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire