Closed WorldSeso7 closed 7 years ago
Sorry for the late reply, i believe you should do the following: 1- Use and Implement the following interfaces:
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
class A extends Vinelab\NeoEloquent\Eloquent\Model implements AuthenticatableContract, CanResetPasswordContract
{}
2 - Use the following traits:
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
class A extends Vinelab\NeoEloquent\Eloquent\Model implements AuthenticatableContract, CanResetPasswordContract
{
use Authenticatable, CanResetPassword;
}
3- And set a protected hidden properties array:
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = ['password', 'remember_token'];
With this setup done properly you should be good to go.
To those people out there whom just like me, experienced a terrible Auth::attempt() issue. The solution of @KinaneD solved my problem.
I'm using Laravel 5.3 and by doing only:
class User extends NeoEloquent
is totally incomplete. I think the documentation should be updated.
To others who has issues with:
Illuminate\Foundation\Auth\User
(this is probably an issue with Laravel 5.3)
The User model needs to be modified to this:
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
class User extends NeoEloquent implements
AuthenticatableContract,
AuthorizableContract,
CanResetPasswordContract
{
use SoftDeletes, Authenticatable, CanResetPassword, Authorizable;
Hello! As the title, when you have a model with a field that is hidden and fillable (i.e. password) if you create a new model with a related one with Model::createWith() this field isn't added to the record. Ex.
I found the solution by adding $instance->setHidden([]); on line 838 of src/Vinelab/NeoEloquent/Eloquent/Builder.php