Closed abhivachan closed 7 years ago
I have further debugged the PHP code and getting error in
Type error: Argument 1 passed to Illuminate\Auth\EloquentUserProvider::validateCredentials() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of Sample\NeoUser given, called in /home/vagrant/workbasket/php/projects/sample.dev/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php on line 387
Can you post your User Model?
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Vinelab\NeoEloquent\Eloquent;
use Vinelab\NeoEloquent\Facade\Neo4jSchema;
class NeoUser extends NeoEloquent
{
protected $table = 'User';
protected $connection = 'neo4j';
protected $fillable = ['name','title','firstname','middlename','lastname','email','password','isadmin','isactive','created_by', 'updated_by'];
public function createUser()
{
$user = NeoUser::create(
[
'name' => 'ssuresh',
'title' => 'suresh subramanian',
'firstname' =>'suresh',
'middlename'=>'',
'lastname' => 'subramanian',
'email'=>'ssuresh@example.com',
'password' => bcrypt('password'),
'isadmin' => 'yes',
'isactive' => 'yes',
'created_by' => 'ssuresh',
'updated_by' => 'ssuresh'
]);
$user->save();
}
}
composer.json
"vinelab/neoeloquent": "1.4.*",
config\database.php
'neo4j' => [
'driver' => 'neo4j',
'host' => 'localhost',
'port' => '7474',
'username' => 'neo4j',
'password' => 'neo4j_password'
],
Auth.php
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => Sample\NeoUser::class,
]
],
App.php
'Vinelab\NeoEloquent\NeoEloquentServiceProvider',
AppServiceProvider.php > register()
$this->app->bind(\Illuminate\Database\Eloquent\Model::class, \Vinelab\NeoEloquent\Eloquent\Model::class);
Any help will be really appreciated. :-)
Well the User is missing theimplements \Illuminate\Contracts\Auth\Authenticatable, \Illuminate\Contracts\Auth\CanResetPassword
interfaces from the original Laravel User, they also work in NeoEloquent. Those are the ones that make Auth possible in Eloquent in general.
Thanks for your help . :-). I tried and getting another property error. array_filter() expects parameter 1 to be array, null given in Grammar.php line 812.
Is there example implementation will be really helpful?. I am not sure what I am really missing it.
My revised model is below.
class NeoUser extends NeoEloquent implements Authenticatable, CanResetPassword
{
protected $table = 'User';
protected $connection = 'neo4j';
protected $fillable = ['name','title','firstname','middlename','lastname','email','password','isadmin','isactive','created_by', 'updated_by'];
public function createUser()
{
$user = NeoUser::create(
[
'name' => 'ssuresh',
'title' => 'suresh subramanian',
'firstname' =>'suresh',
'middlename'=>'',
'lastname' => 'subramanian',
'email'=>'ssuresh@example.com',
'password' => bcrypt('password'),
'isadmin' => 'yes',
'isactive' => 'yes',
'created_by' => 'ssuresh',
'updated_by' => 'ssuresh'
]);
$user->save();
}
/**
* Get the e-mail address where password reset links are sent.
*
* @return string
*/
public function getEmailForPasswordReset()
{
// TODO: Implement getEmailForPasswordReset() method.
}
/**
* Send the password reset notification.
*
* @param string $token
* @return void
*/
public function sendPasswordResetNotification($token)
{
// TODO: Implement sendPasswordResetNotification() method.
}
/**
* Get the name of the unique identifier for the user.
*
* @return string
*/
public function getAuthIdentifierName()
{
// TODO: Implement getAuthIdentifierName() method.
}
/**
* Get the unique identifier for the user.
*
* @return mixed
*/
public function getAuthIdentifier()
{
// TODO: Implement getAuthIdentifier() method.
}
/**
* Get the password for the user.
*
* @return string
*/
public function getAuthPassword()
{
// TODO: Implement getAuthPassword() method.
}
/**
* Get the token value for the "remember me" session.
*
* @return string
*/
public function getRememberToken()
{
// TODO: Implement getRememberToken() method.
}
/**
* Set the token value for the "remember me" session.
*
* @param string $value
* @return void
*/
public function setRememberToken($value)
{
// TODO: Implement setRememberToken() method.
}
/**
* Get the column name for the "remember me" token.
*
* @return string
*/
public function getRememberTokenName()
{
// TODO: Implement getRememberTokenName() method.
}
}
It works. :-). It is implementation issue and not the framework issue. I am sorry for that.
@abhivachan how did you make it work?
how did you implement Authenticatable when it is not an interface
I am using laravel 5.3 and installed in Homestead. I have followed the below steps
When I try to login with user id and password, the error is below
ErrorException in CypherGrammar.php line 99: Undefined property: Illuminate\Database\Query\Builder::$matches
in CypherGrammar.php line 99 at HandleExceptions->handleError('8', 'Undefined property: Illuminate\Database\Query\Builder::$matches', '/home/vagrant/workbasket/php/projects/sample.dev/vendor/vinelab/neoeloquent/src/Vinelab/NeoEloquent/Query/Grammars/CypherGrammar.php', '99', array('query' => object(Builder), 'components' => array('matches', 'from', 'with', 'wheres', 'unions', 'columns', 'orders', 'offset', 'limit'), 'component' => 'matches', 'cypher' => '')) in CypherGrammar.php line 99 at CypherGrammar->compileComponent(object(Builder), array('matches', 'from', 'with', 'wheres', 'unions', 'columns', 'orders', 'offset', 'limit'), 'matches') in CypherGrammar.php line 72 at CypherGrammar->compileComponents(object(Builder)) in CypherGrammar.php line 29 at CypherGrammar->compileSelect(object(Builder)) in Builder.php line 1581 at Builder->toSql() in Builder.php line 1648 at Builder->runSelect() in Builder.php line 1634 at Builder->get(array('')) in Builder.php line 613 at Builder->getModels(array('')) in Builder.php line 318 at Builder->get(array('*')) in Builder.php line 288 at Builder->first() in EloquentUserProvider.php line 104