Tuesday, 30 September 2014

Class 'app\models\Eloquent' not found in Laravel

If you are creating Model Class on custom folder and if you are using Eloquent, please don't forgot to use the namespace as well as use Eloquent as below;

In fact not calling use Eloquent can cause the following error;
Class 'app\models\Eloquent' not found in Laravel

The sample class can be written as below;
namespace backend;

use Eloquent;

class Page extends Eloquent {

    protected $fillable = array('id', 'alias', 'title', 'content', 'last_updated', 'status', 'views');

     * The database table used by the model.
     * @var string
    protected $table = 'pages';

     * Function action
     * @return return type
    public function youFunctionName()
     // code here   
}// End of class

"Whoops, looks like something went wrong" on Laravel

After you installed the Laravel, you can stuck with the following error,
"Whoops, looks like something went wrong"

then, you might have forgotten to enable the debugger which can be enabled on app/config/app.php file.
// look at the beginning of an array
'debug' => false,

// change to 'true'
'debug' => true,