1

I'm trying to use the Versionable Package in my Laravel 4 app based on the new, trait based implementation like this

<?php


use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;

namespace MyApp\Models;

class User extends Eloquent implements UserInterface, RemindableInterface {

    use Venturecraft\Revisionable\Revisionable;
    ...

When i use this code above, I get this error

Class 'MyApp\Models\Eloquent' not found

I have also tried changing the namespace to app\models but it still shows the not found error.

Please could someone help me out here? I followed all the instructions on the Github page but as I'm new to Laravel, I may be missing something.

duellsy
  • 8,497
  • 2
  • 36
  • 60
Tochie
  • 59
  • 1
  • 10

2 Answers2

3

You could use either of the following solutions:

Change your class declaration to:

class User extends \Eloquent implements \UserInterface, \RemindableInterface

Or, simply remove the line:

namespace MyApp\Models;

I would recommend taking the second solution (removing the namespace) for now, until you are comfortable with namespaces in PHP.

Additionally, you should be using RevisionableTrait, not Revisionable, e.g.,

<?php

use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;

class User extends Eloquent implements UserInterface, RemindableInterface {

    use Venturecraft\Revisionable\RevisionableTrait;
duellsy
  • 8,497
  • 2
  • 36
  • 60
0

You must write fully qualified name for Eloquent

class User extends \Eloquent implements UserInterface, RemindableInterface
masNug
  • 26
  • 1
  • 1
  • 5
  • Thank you @Masnug. Tried that but it shows a new error: Interface 'app\models\UserInterface' not found – Tochie May 05 '14 at 09:06