Conflicts with the ConfideUser class

6

In my User model, I left my protected $table = 'usuarios' and in auth.php the same thing, but when calling the save() method of Eloquent, it recognizes table ' users ' and not ' users ' as I instantiated.

So, I renamed the table ' users ' to ' users ' again, just for testing, from which he recognized the table, but the return of save() was always bool = false

I decided to do another test by changing the header of my User model from

class User extends ConfideUser implements PresentableInterface {

for

class User extends Eloquent implements PresentableInterface {

And incredible as it may seem, it's back up and running normally. My renamed tables worked and save() started working too.

What can be happening? I can not leave it that way because I need the Confide class in my project.

I created a simple test-only route:

Route::get('teste', function(){
    $user = User::find(3);
    $user->background = 'teste';
    dd($user->save());
});

My Model User:

<?php

use Zizaco\Confide\ConfideUser;
use Zizaco\Confide\Confide;
use Zizaco\Confide\ConfideEloquentRepository;
use Zizaco\Entrust\HasRole;
use Robbo\Presenter\PresentableInterface;
use Carbon\Carbon;

class User extends ConfideUser implements PresentableInterface {
    use HasRole;

    public function getPresenter()
    {
        return new UserPresenter($this);
    }
    ...

My auth.php file:

<?php

return array(
    'driver' => 'eloquent',
    'model' => 'User',
    'table' => 'users',
...
    
asked by anonymous 17.01.2014 / 20:23

1 answer

1

You should, as per the package documentation guidance, use the user class as follows:

use Zizaco\Confide\ConfideUser;

class User extends ConfideUser {

    // No seu caso, usando outra tabela:
    protected $table = 'usuarios';

}

Of course, you have tried this, but see if there is no method being overwritten, remove the implementation of the PresentableInterface interface and all custom methods and test.

If you are overwriting some method you may be bugging some inherited functionality.

    
18.01.2014 / 04:48