Comments (17)
Could you show some code? You can also email it if you prefer.
from laravel-mongodb.
Here is the model in question
<?php
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;
class User extends MongoModel implements UserInterface, RemindableInterface {
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'administrators';
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = array('password');
/**
* Get the unique identifier for the user.
*
* @return mixed
*/
public function getAuthIdentifier()
{
return $this->getKey();
}
/**
* Get the password for the user.
*
* @return string
*/
public function getAuthPassword()
{
return $this->password;
}
/**
* Get the e-mail address where password reminders are sent.
*
* @return string
*/
public function getReminderEmail()
{
return $this->email;
}
}
I have an Alias set up for MongoModel. Its the standard User model that is shipped with laravel really
from laravel-mongodb.
I added the interfaces to the user model I use in the tests, but I did not get the error.
from laravel-mongodb.
How odd, I'll have a dig round and see if it could be anything else.
Thanks for looking
from laravel-mongodb.
In the Auth config file should I be using 'Eloquent' or 'database' as the driver?
If I use Eloquent I get a different error, which is: Trying to get property of non-object
on line 109 of vendor/laravel/framework/src/Illuminate/Auth/Reminders/DatabaseReminderRepository.php
$createdPlusHour = strtotime($reminder->created_at) + $this->expires;
I think this is because the date is now an array which it is not expecting.
from laravel-mongodb.
For authentication I am using eloquent
, and in my database config I have mongo setup as the default connection which Eloquent should use.
Edit: I haven't tested password resets yet
from laravel-mongodb.
The problem with using the Eloquent driver is its throws the error I wrote about above.
from laravel-mongodb.
I've added a question on Stack Overflow to see if I can get to the bottom of the issue. Once I do I'll post back here
from laravel-mongodb.
I will try it out in a laravel application to see if I get the same error.
from laravel-mongodb.
Running into this issue here as well, digging in unless someone has found a solution...
from laravel-mongodb.
What features are you guys using from Auth? I created a user and logged in using Auth::attempt
and did not see any errors.
from laravel-mongodb.
The error I am experiencing is with Password::reset
from laravel-mongodb.
I'm not getting this error. This is the header of my user model:
<?php
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;
use Jenssegers\Mongodb\Model as Eloquent;
class User extends Eloquent implements UserInterface, RemindableInterface {
Everything else remains unchanged. The auth driver is set (by default) to 'eloquent'.
from laravel-mongodb.
Are you using the standard password_reminders table (in this case a collection)? My issues are in the DatabaseReminderRepository
class in namespace Illuminate\Auth\Reminders
on line 110 there's a check to see if the reminder has expired, which is unable to perform due to the nature of the data being passed to it via $reminder->created_at.
Ugly core hack, change line 110:
$createdPlusHour = strtotime($reminder->created_at) + $this->expires;
to
$createdPlusHour = strtotime($reminder['created_at']['date'] + $reminder['created_at']['timezone']) + $this->expires;
from laravel-mongodb.
Oh, I was looking at line 216.
I don't really know how to fix the issue with the date object. @philipzaengle, could you try this for me:
$createdPlusHour = strtotime((string) $reminder->created_at) + $this->expires;
from laravel-mongodb.
Never mind, the toString method of the MongoDate class does not return a nice date string.
from laravel-mongodb.
I fixed the password reminder issue. Check out the Auth section in the readme: https://github.com/jenssegers/Laravel-MongoDB#auth
from laravel-mongodb.
Related Issues (20)
- NOTIFIABLE NOT WORKING, Cannot access offset of type MongoDB\BSON\ObjectId in isset or empty in HOT 1
- MorphTo relation won't work when eager load if target model has different primary key HOT 1
- [BUG] hasMany and hasOne relation not working with ObjectId HOT 2
- toSql() Alias from toMql() HOT 4
- [Feature Request] Add enum collection cast HOT 1
- MongoDB\Driver\Exception\BulkWriteException: not primary in /app/vendor/mongodb/mongodb/src/Operation/Update.php:209 HOT 2
- Polymorphic One to One (MorphOne) Relationship [Feature Request] HOT 3
- BelongsToMany detach() doesn't remove id from both collections
- Transaction level not working when use closure
- Unique Rule ignoring fails
- morphOne $model (mysql) -> relation (mongo)
- how it's will work with laravel passport with crearting issue not able to generate personal access token or password HOT 1
- updateOrCreate does not create DB entries HOT 9
- PHPStan errors after 4.3.0 upgrade HOT 1
- How I use laravel passport with this mongodb package ? As I creating Apis for my project so I require passport package. HOT 1
- `createOrFirst` is not triggering `creating` nor `created` model events HOT 8
- [Feature Request] getChanges() not supported HOT 4
- updateOrCreate -> createOrFirst doesn't work as expected HOT 3
- Memory leak when setting nested keys using dot notation HOT 3
- [Feature Request] Use transaction in AWS DocumentDB HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-mongodb.