mercredi 22 janvier 2020

It fails to call relation method on same model? returns error "maximum execution time of 60sec" (laravel)

I have a model User which has a relationship to Notification.

class User extends Authenticatable
{
    protected $with = ['notifications'];

    public function notifications()
    {
        return $this->hasMany(Notification::class, 'subject_id');
    }

    public function unreadNotifications()
    {
        return $this->notifications->filter(function($n){
            return $n->seen==0;
        });
    }
}

After I make that unreadNotifications method it starts to fail:

Maximum execution time of 60 seconds exceeded

Even just calling $this->notifications it still fails. Somebody knows how to fix these?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire