Conflicts with the Confideuser class

Asked

Viewed 74 times

6

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

So I renamed in my Mysql table the table 'users' for 'users' again, only for testing, from that he recognized the table, but the return of the save() was always bool = false

I decided to do one more test by changing the header of my model User of

class User extends ConfideUser implements PresentableInterface {

for

class User extends Eloquent implements PresentableInterface {

and amazingly, it started working again. My renamed tables worked and the save() started working too.

What could be going on? I can’t leave it that way because I need the class Confide 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',
...

1 answer

1

You should, according to the guidance of the package documentation, use the user class as follows:

use Zizaco\Confide\ConfideUser;

class User extends ConfideUser {

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

}

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

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

  • I left my Model exactly as described above and the same problem persists. I tried to search to find if there are any classes overwriting her, but found nothing.

  • in conversation with Zizaco, the same informed me that the conflict may be in the dependencies of Ardent.

  • Zizaco updated his confidence to not depend on Ardent, but I’m still having trouble saving. If I do a search, it returns the result of the table 'users' normally, but if I use the command save() or updateUniques(), it tries to save in the tables 'users'... you know what may be happening ?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.