I have a User
class that extends a Base
class which extends Ardent
. I'm toying with the idea of using Confide 4.0 for general user management, but when I add the ConfideUser
trait to my User
class, everything blows up:
Declaration of MyProject\User::save() should be compatible with LaravelBook\Ardent\Ardent::save(array $rules = Array, array $customMessages = Array, array $options = Array, Closure $beforeSave = NULL, Closure $afterSave = NULL)
If I switch my User
class so that extends Eloquent
, everything works fine. If my User
class was extending a ConfideUser
class, I could simply override the save()
method with my own implementation. But since ConfideUser
is now a trait, I have no idea how to override the save()
method to make it compatible with Ardent, or if it is even possible. Any suggestions?
I've had the same problem and solved it following instructions found here: http://stackoverflow.com/a/11939306 My user model now looks like this:
<?php
use LaravelBook\Ardent\Ardent;
use Zizaco\Confide\ConfideUser;
use Zizaco\Confide\ConfideUserInterface;
use Zizaco\Entrust\HasRole;
class User extends Ardent implements ConfideUserInterface
{
use ConfideUser{
save as confideSave;
}
use HasRole;
public function save(array $rules = Array(), array $customMessages = Array(), array $options = Array(), Closure $beforeSave = NULL, Closure $afterSave = NULL){
return $this->confideSave();
}
}
Note: I haven't done a lot of testing, but my seeder used to fail - not it works.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community