Flatorb / moldssp

MIT License
0 stars 0 forks source link

Having issues with eagar loading relationships from the databases with Moldssp::paginator() #5

Open gg-aditya opened 1 year ago

gg-aditya commented 1 year ago

I have two collections (tables) as specified below.

  1. users
  2. posts

The models are "User" & "Post". The relationships between these two tables are as specified below:

  1. user "hasMany" posts
  2. a post "belongsTo" a user.

User Model

namespace App\Models;

use Jenssegers\Mongodb\Eloquent\Model;
use Jenssegers\Mongodb\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class User extends Model
{
    use SoftDeletes, HasFactory;

    protected $collection = 'users';

    public function posts()
    {
        return $this->hasMany(Post::class, 'user_id', '_id');
    }
}

Post Model

namespace App\Models;

use Jenssegers\Mongodb\Eloquent\Model;
use Jenssegers\Mongodb\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class Post extends Model
{
    use HasFactory;

    protected $collection = 'posts';

    protected $casts = [
        'created_at'    =>  'datetime:Y-m-d [H:i:s]',
        'updated_at'    =>  'datetime:Y-m-d [H:i:s]'
    ];

    public function user()
    {
        return $this->belongsTo(User::class, 'user_id', '_id');
    }
}

When I try to eager load relationship using the 'with()' method of the eloquent model "Post", the relationship data is simply not loaded.

Code

return Moldssp::paginator(Post::with('user'), $request)
return Moldssp::paginator(Post::query()->with('user'), $request)

Response

{
    "current_page": 1,
    "data": [
        {
            "_id": "63e348deca9468f0dd0e7054",
            "title": "FYa6zzmay5 k4P3qc9x0Wo0N3F",
            "description": "V47GRWEqkmx6dYAxWtmbaTCkkT3MqYkjqFHAxtf4bZAocopg2k41zyTQWCD2aLZv2OBPOfr1Q3QkHWv2PkXoRXyYNF8NCxC2qre2BKIOViVWfO4wI8BjA6WSLmQbmjWGW0uOGAvbjooqXanlM1P5QnCAgWKPiTEH5dchIOF9MLdJEisJy7Jb8cnfsbzUlP8TeTT5Pz7ZHFmLK9T3VvavTJEL5YivJJalH7JK9bQ5LoWZX1fkMp1EIZD5Y6FRGVd",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": null
        },
        {
            "_id": "63e348deca9468f0dd0e7058",
            "title": "cQ3YMLrFw9 vbXiNfZQjWf8Rvi",
            "description": "oXTNMqmhUeQjG3CfNbN3h531wI7070T0X6UTDtZAb8HzMiNj6MApjeWgW49J3NsqFd0AvJUV3cnCSoHV2RN2AXdvnP8rMLycitb9A5QROw7iS3Lx7a7XBCmJABNZnwa2OZiSFzEKRVgvTx4JoR2cyjMgaGzivVEe3Bcvg5sRUbK3OoMjHidvmVwkHUkCIX2Lbg6ut9g7Xj1pJvgYtuLb8sbfP2iBq10FtuuJ3WO9oWB3bNCJf8tXpvOm4hsRPfG",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": null
        },
        {
            "_id": "63e348deca9468f0dd0e704c",
            "title": "u9tTuE65I8 wsD4dhjT3fSGeBP",
            "description": "zTIlAyfHjD2YpJJeiMnRnFCrhLyYecN6vjTPMg3Ze0ax5MDXxmD4Rf0S4w8chWhHMfEtdhXsBejD0jGaYPsAI8VsQUsORmr69NRm3wzmQqRwW6lB4T5yAs52jvGEgHCwtFVlNDGmasrsHoObYv5nplS24dOhpOJByqM1ORY4XZr6bwUDH93Z7zKPgZR27gH1CNseOoSjVEbik3XC41W6wwH704wnjkCnRkqsUvJWcqTYTzw0fm6BO5MNNvxJCkb",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": null
        },
        {
            "_id": "63e348deca9468f0dd0e7052",
            "title": "caabRvtX2i FCKDhrRMpwNNNUH",
            "description": "JftspCCvlWQOEwz9erOAtoVn1ZTIRcJz5dhIHbqHnkvcjyxndU7SHg8sgNl9aYkGV4qfG3ezBadXQbDiVx14uBeQFfdSCEuCTdjUttJXvNPsUT38ZN5G8mXitCfF5dbdWl9XSUghnYPEzKkzYW9Y2zEAI4PXQiEtvuSYVrv4YclRmKKxkOx91HTjVp7I4J73GmySkfg2OAfU1gHHrsA5RFlTXw7x1LO9YorzZreLuhDgoAUCIZLo8DwXBxlMpjD",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": null
        },
        {
            "_id": "63e348deca9468f0dd0e704e",
            "title": "MS10SrkeNO 548rTRwzUyn7ScN",
            "description": "O3VNw1Tq18y4i2zbdzgPeQYedpL9f8jhxd0yVtzUaHY3BoRLWt1svR1qIvl2pRElzyrVT4ajvH56G1LKq99SnLrTXmuUQTP1S1C62tr9EubB6bHJB7Ic9W6YK652scIMyj2JtW2TFZDGpe4rJS7p0dZSSzvxFvyimR8rJuNkv3LjzSByMrDbgfcbbhaXYkFTKccEYPA2mtiisPsFbtRAufaVQ21XsjuqbrO16t5tw3AEYClHslfdCFtUK2IqymP",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": null
        },
        {
            "_id": "63e348deca9468f0dd0e704a",
            "title": "6p41bn1ulE pzvOEg7WW0FyqG7",
            "description": "lgRgiNJfWu5hofRSDzGueHCsCLdfGX795ZQYA9engadbgL5PjMySX5KNIP1NalIzvTVZWWONGVYqDYY711R4g1V3KvLC8RweV6VnKLCSC0MrKfgyBZAg44gmCVePjGKcbTj2899otxIw2JdALXXCOHo3v3M61gxVOjh7169rElgKYFnSJN8EeRBjTmkDop4exJ2A9W7cwBr7eUJYpUsiK6Bjbc4qYFgcTqg67nFmLmboy2kvdGkdMo0z4XGxEjP",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": null
        },
        {
            "_id": "63e348deca9468f0dd0e7056",
            "title": "Di4pXUk1Sz CHR2HwtdyodHLA2",
            "description": "I1BMjhz9Azh4iUCrpCa1mjm0LiatMTqXGUS1JlbTmA5ACgr3bQbxp6dorlqwCGsUv1PsYvvEEg4GHJw260hvK48VbmNU3uuFKrMelCqhpcX3YkkoxB96chJyIuLgNm159Au7bPOXfy7rT50q0zB8LqJMkfHokOkxMiQYF6dNhZ3tLWTOkKzX6lvPevuHLQoiVVGT2xLcCoDZ54ur3Oh39XLKCncMs39w7Y5vL0gZlCrQy5mNezPQraKFythbHrQ",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": null
        },
        {
            "_id": "63e348ddca9468f0dd0e7046",
            "title": "qVWwLRbCMP Zc6Avm4LVicDo6a",
            "description": "u5K8CGbU9iGafK5waQnN3kgp3vn3s1D5wItauwjP2SrKZcshqlDMJO9baTRwgWZ6Xbdt40RE8WxMnNFFh9dzp53ffV5dciDrqPLrO1f2rUf4N60JCi6mfKkESs4GUgAuFP14N1nGmuTdooPaVVOsfWyOWKhSWlVTMceP7cc86PmdBUGUXxfO7d5OVTp0AsFPm6Q7tcnuzJMNXnxgTNt8XvySmxRtPkWofzZ7crPh6o2YgM8ValU6hWxfdV37Czr",
            "updated_at": "2023-02-08 [07:01:49]",
            "created_at": "2023-02-08 [07:01:49]",
            "user": null
        },
        {
            "_id": "63e348dfca9468f0dd0e705a",
            "title": "KqxxPp5ovZ CqZCiAW9bcMkP0r",
            "description": "cLjTdYoqJxVTvGCvvbvVWGsdIIaowUFsrA2FxZiZ3aDxLhjpNxkXZPbHVfKKYUxDQHACQM9oY2rlMDhKdhmn6xzi8MbDW0RezbgWtBZn7IQWpxJpfv3XGn7TDt9OqEjmk5JLmMRp3U5JG2EnaIFIwC926QtFNswLaZkuJL0XfQWUnSBQ8OPiwpGAxBHfBOwtUII5RiStHThWvvoqOiQGLNcdQWyB6S5k2PTWHb4kgnJumeeKBbQAq4KhzFrs7N6",
            "updated_at": "2023-02-08 [07:01:51]",
            "created_at": "2023-02-08 [07:01:51]",
            "user": null
        },
        {
            "_id": "63e348ddca9468f0dd0e7047",
            "title": "tBbxwBcb9i ai6H2BVKMnOuT9j",
            "description": "YZgLUiw0UzSVVSKPBs7xvVmiwzR9dSwkcpeBFarP6uTRvo4AcQGB8maQKkTuP7f7f870xrrxLJFX3zJKaLxvewlhmlsYip3LCHhZnQ8WvFk5faFs9yMe31RoZCAjgITiwnLLdYWzn9J7Yf8zWBujIbUGjbgHBxUwTqG9PFWiwbQ0D3DR1b0E3bpvpYQUZvFhULgpUluyumLksPFf66kaqgXq3JsBAb2VVbxvZdBZEsjaLhwwn4vPxU5EzXVjVik",
            "updated_at": "2023-02-08 [07:01:49]",
            "created_at": "2023-02-08 [07:01:49]",
            "user": null
        },
        {
            "_id": "63e348deca9468f0dd0e7051",
            "title": "yc6MFVFOLz dPIFmYu5gSrermY",
            "description": "jPuGkZ8wCdQQlNop7YSRNX05YMHHuRsCLToLqUhoeaY3NMaixtQaJUOZIVgqehoYpSjEl0wA7KSNe4CxOwEaeJrn98t0jHHaLuMuGBYMNN4Sz94wfJC1VXz077s9vvk07SYJx2HzWg69Y9ugrooXGpzOmo3z8dDL5IxmvWo70k5CMtzUnr92QYWZc4FerOjMuYB1KUQwRVlL57T9egkpJlZSz0vqUbMOGv3r5zdYDLn0UNaJhX79MP44bG3j9Ig",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": null
        },
        {
            "_id": "63e348deca9468f0dd0e704f",
            "title": "GtTrh1qXl3 p3jdOBFZkmzBGJB",
            "description": "dA0sQ0uY3ixJfH890l4hYuKQAvO6Zpjr0n4BWIyrP7vXVO71frLw8MyjudGkfR9rkQyoEX43gPTM0ItEciEpO8hcyZE1K8yZ18tmyU6rpAuAOG1PQWmW3KgBkhQ2yuuqqqXiwSceqSaliPIsyGYx7yhEsHGftqkdPpiwciQtg15x8BCarqpwjsHZUz2kUzNgfM6uApJS7hT08aeg7Hf54vUHFSKzE48v4XcmMrUg5mEfEAvkjjGKQU6s5cFp8lQ",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": null
        },
        {
            "_id": "63e348deca9468f0dd0e7049",
            "title": "l6tLopSfAi 9s9Wdd7kQUBN01l",
            "description": "yRl3caxqcPOsCSZKeHv2O7Vg7JzXZv2cV7nxf5qJ4tT3SV6RE0Gfmoc1pm3BNLM5Q1nKt6vz5f90ESQHwMaUsGZXB3Lup028BMLpbw4hsnPSVOziuGR8Yf4J3UbdAqVzLQv2GGUZGBAWSPt5PwGwq78Vs4ZgbS2XJiJX1GN6XFQ0TmXbvblDYomsBWi8kHG7NpYwpT5OiCO4qNnI4judJw4gVve94LU7IDrH6gQBPqKsZmeII3iOB7BMdhhdTsO",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": null
        },
        {
            "_id": "63e348deca9468f0dd0e7053",
            "title": "bsqKinCI5z p0zJNPT7mKaqHS6",
            "description": "zz1FqtD71GDoviLDMUbF8GghzV8dqdR3EHcYaiCDtyOLpp4mldty1TgQkgxPe0GbZFKzbkdabdqRRPmc9PV3hc1b4dZcAgbHnYlNarFVKLWL9UMfr6wZhuUlqpVxzy1jQuQe9I8Ap6zCX4vP4phzPOG2Zmmbw5c7IsktW1kzvGzqNXfLpyr00uWJ4g9nbZD0hLpAzD0e6xPR15sbBBSf5b7VQYOHQpegqSstICbpMjzPU9p9ISpF3rpp0byj0d4",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": null
        },
        {
            "_id": "63e348ddca9468f0dd0e7045",
            "title": "maLFV35t5K aKC4Lt6xOYeSWV6",
            "description": "zL2Y7y1u6kjQMsCeZuySseu5YbygMKJ7sDdLuUgZ4EoKrF6L8xp3lv77OxYtCvu0UQaZN7VKoJXVNSQO05LYeI1BpBzLNth0zz4fX4q9GR9MeKVE717FFFRJFGyDMDKNQT1ycuxtffiUxQKOvUA8x9qEQXDn1q6mFahJgdRdBtRccCMS9OLLN8U2j2ytG5sj5M3o4FEhCtIDG6hH4sikc9ZiRr0gL0aWenBEIgw0yUV0cShtfN0itsHvdB3WvxW",
            "updated_at": "2023-02-08 [07:01:49]",
            "created_at": "2023-02-08 [07:01:49]",
            "user": null
        },
        {
            "_id": "63e348deca9468f0dd0e7055",
            "title": "3pIpmoFFqc wzrHW7zwW7UT3ly",
            "description": "e7F2YQBxzeIx7EFaPCPMVg2hmC5FPEGpoJsEeiRvHxoyLFsHgIUL1nxTmUCgPAeyb7IDxwVVRT38YKjwtvAE4emzEo5qgMoGDnBvV5SbcDet3a0X3ga4obF6h3t6b3gQCd8J9cxhVbDvKPPPPfsM8EEtDtfq0vVmd0d8zwB43lAbVzUYZtGaWXQEPJDkLlyavXnUugfLRT9IZsQA9FVWhDjEs3zN4BAfPl5d96yHx9Wblm1yKaqA3UBXJbCqXTj",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": null
        },
        {
            "_id": "63e348deca9468f0dd0e704b",
            "title": "kCpq3ewmIA 9lG4J5pyZIeOLdL",
            "description": "7pcWS1ggCZP38BVA2T3UZeGVQ6xV3Da4COP9adS2MPm2cfyifwYshGSWU9b5N1DTcGmOoWq3dGj3z7adBW9EXT64KW5ZOzm1mtf7CjbwFB2Avz0Yax6b5iYI2XwcOEK8GZeCu28dvPivy0uvu8k8xhHQOcbPmx2VcBaVntuzmsbXpjMDy5Z8NFYjvw7rOxnoWto7zTFKiBjFCsP295cRO7fc1CRtqrdDwHfE8cES7TtFfvj5dHVNmCwk82c69Z3",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": null
        },
        {
            "_id": "63e348deca9468f0dd0e7057",
            "title": "M0vR4apM2s DUiZIZu5oUTzZte",
            "description": "ZhhR6gWhKjntS2BzDNbHV1PL52RY8fbtoNRGDX6TvxW4v4vWxw9hsDJTcs4AInLj6sw39d1EeIlr5U0gfPugTolyWXRn4kMjhyFc0ZlinewwVbuz6oAjaExPbC9UGlHPPiLepfy1qX0xM15pwtkEmNdP39M72D5i1pMb5D6Ywj06yJb2oGf58ikYCP5fHdmEsI35Vmlp2ErgtpAxJxyL7nYudAwG6I0m8507tGjXSkCNJICwp3jaL0YVQhRVopx",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": null
        },
        {
            "_id": "63e348ddca9468f0dd0e7043",
            "title": "o55onitxgO 7z45oXHh9y8f7Ha",
            "description": "qDsNiNzqIPxWnQSUwtJyDiP45MwNkPF3yWh3TZGQVq34Er8mPg0hW0NFsh1tzlk74YvQ9f9KNlsF1Vf0ooE3GllglsgOzXGpVK9oQ0XWGgZe4aL2Tuk3xoZvgrEiiQn7So8IeMWXBNmlGupZKA4qMmGtrP09oeBbHD4trxz1BXDJtpdR1lhqFMiidRu6qyMR1QpSBJlyIpITxPLPVJF1YQ07GO9Wh57EOBx1HrFvMkBsTooAWgrwU6WqVrGk1hV",
            "updated_at": "2023-02-08 [07:01:49]",
            "created_at": "2023-02-08 [07:01:49]",
            "user": null
        },
        {
            "_id": "63e348dfca9468f0dd0e7059",
            "title": "TItyUbruEZ Zb4KDDN7i0HxEke",
            "description": "PiBXl4vf5AgLURs40lirH8tJc0IG7UNcGwN7Z9nWFXnKLaNxkSAqcliSxOuNQGnvwgWzbegipgJ0fIf2KMCdjvEM3TW4FS7mWLeLVZyTcFOAiKbmbaoFcHmytL510XXsyoF49QsrUB7iVsSLHOAanl21Hh41Vy2niaBsWzNafd6sAnqkgAE5dNAKI8GcW5ZYVsmjOU2y3AvWWTsNzXl323bUfImP6XcE2fiOfQCsQvBJHOc4IsguX8z0i5YyDeD",
            "updated_at": "2023-02-08 [07:01:51]",
            "created_at": "2023-02-08 [07:01:51]",
            "user": null
        },
        {
            "_id": "63e348deca9468f0dd0e704d",
            "title": "r4wD0ZrEJB XcFgYdPJQeqDFqT",
            "description": "4T6k6wpTtxOhPePvIIFYJmsRYh0gexWSq2Bs1h5k4Co1x2qX1XgN7tox6mIiCpkVbQlEHEj9UHTQQdHkyjW3RaRo2MojV4q1B0zSyRsoSvKgo1PQIvGaNBSn2CIAHedNFXp9jjBlodLZMbDG8zPKNLjRxMorPxDjNH9ehY6dRrLY2HsrmkdV0JD2ZP9NgCKfy0nRaY2HrAnosBI7E7aXXHq55PYvNZex5qmjENhaj6cp5K8v7ZVhPvwYjvxRqSg",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": null
        },
        {
            "_id": "63e348ddca9468f0dd0e7042",
            "title": "nGZ84DK17T 5WlcxIK1pgP8N9Y",
            "description": "ie9rK7EnJ6duINYcJJDigSPRDD8MhQPe9ez6gCtxFmtp4xW1TO6PsbAKaZibcI5ZvHc6ggCu2LgfrCnR3boPYaGi7PoqpwYwGGDYbHiJtyzX2O6jHvKDCknItN4WLPU01l54TZTiYRV23sjWBNE6KRBfXflFDPNKJcLLh6ID3LGnmpncUaraQjD2JewNLtHwRBUHTBYIDa9CVHNDeFy3pe8mAtk0KvGxTTfS8IHoOSbhR2tgh0aBwE8otHC6JkK",
            "updated_at": "2023-02-08 [07:01:49]",
            "created_at": "2023-02-08 [07:01:49]",
            "user": null
        },
        {
            "_id": "63e348ddca9468f0dd0e7044",
            "title": "7jxmI8emXX nsDR3i2Rb4mtaa8",
            "description": "0LvRloHxoY6bLvOqzUHqL4i60yOMymvGdiyeaM8yj3zVtigWtZrvcrH45jLD0gfLo0XjjGS0GUlex9m45GFREnyZwNhEJifme5NtLkzRC8STegYxQ4diZLKwVBp9M6R4Mx6G4RbaCKIKm1UZl8CnLI2SJX6E0iacE4LVPb0jMg3UewTfOi0RyE83Ysd1UA9fErwwc9AP03oyz8Ip0bNwev1RBV1VZwguWpaKqAnO0jGCjO0FAm8UoWIbCYR3hov",
            "updated_at": "2023-02-08 [07:01:49]",
            "created_at": "2023-02-08 [07:01:49]",
            "user": null
        },
        {
            "_id": "63e348ddca9468f0dd0e7048",
            "title": "MbA8hhMCc7 cRezsvJYJmg3qnP",
            "description": "grtXwtAztCKRbBTvC9kJKZmRF8DyHwxPsfaQ5fz0IqaKMfAbsMka076sSzJIvJmMX7GHtFHpSeOUS3ZDzJKOxcX3bFLiH7GrwIZTMMHSb3z4yN1L68HHvsh4tl5RwGqcLUVmJZhihL20ocEahwfiRmeFQ5UwKIJBwkdMjiIM6WjJnD9C9vTrJa4IGMTzWtdjIGHcmZmgCSK65axC1DN28ezu1mTYglVCdTqpD5GYoXbH7PwEY2zjrkMAw0a0ceY",
            "updated_at": "2023-02-08 [07:01:49]",
            "created_at": "2023-02-08 [07:01:49]",
            "user": null
        },
        {
            "_id": "63e348deca9468f0dd0e7050",
            "title": "B8ceaOetg8 dNhth8QrBoVUZGT",
            "description": "257qYoxJ6ccHUkeLDyz4WUzkWUTIqFKSox14fnfMBSOsVT9M6QVOFakaxjfFwhkewKTN7VP3N2lJo93LdreT5zJeSInfzpV41Ijq5Fk036c8ZqoVyY5xQSprMB7dTB2NpfvnhCTDRHOj7PXJVXfVtrqReZHLl9evcTpHHXjcYLcl8ROP8fEub2yjw6yRxRaGmTpDurdNhFW7GRcPZ6evAtz7nX7TOLDiL2d45CXXifCloJ6Sgy2b92EiNP7OP4B",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": null
        }
    ],
    "first_page_url": "http://127.0.0.1:8000/api/api/posts?page=1",
    "from": 1,
    "last_page": 40,
    "last_page_url": "http://127.0.0.1:8000/api/api/posts?page=40",
    "links": [
        {
            "url": null,
            "label": "« Previous",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=1",
            "label": "1",
            "active": true
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=2",
            "label": "2",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=3",
            "label": "3",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=4",
            "label": "4",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=5",
            "label": "5",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=6",
            "label": "6",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=7",
            "label": "7",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=8",
            "label": "8",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=9",
            "label": "9",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=10",
            "label": "10",
            "active": false
        },
        {
            "url": null,
            "label": "...",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=39",
            "label": "39",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=40",
            "label": "40",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=2",
            "label": "Next »",
            "active": false
        }
    ],
    "next_page_url": "http://127.0.0.1:8000/api/api/posts?page=2",
    "path": "http://127.0.0.1:8000/api/api/posts",
    "per_page": 25,
    "prev_page_url": null,
    "to": 25,
    "total": 1000
}

However, when I eager load the relationship normally without "Moldssp"'s "paginator" method, the relationships get loaded.

Code

return Post::with('user')->paginate()

Response

{
    "current_page": 1,
    "data": [
        {
            "_id": "63e348ddca9468f0dd0e7042",
            "title": "nGZ84DK17T 5WlcxIK1pgP8N9Y",
            "description": "ie9rK7EnJ6duINYcJJDigSPRDD8MhQPe9ez6gCtxFmtp4xW1TO6PsbAKaZibcI5ZvHc6ggCu2LgfrCnR3boPYaGi7PoqpwYwGGDYbHiJtyzX2O6jHvKDCknItN4WLPU01l54TZTiYRV23sjWBNE6KRBfXflFDPNKJcLLh6ID3LGnmpncUaraQjD2JewNLtHwRBUHTBYIDa9CVHNDeFy3pe8mAtk0KvGxTTfS8IHoOSbhR2tgh0aBwE8otHC6JkK",
            "user_id": "63e0d342c404541511018188",
            "updated_at": "2023-02-08 [07:01:49]",
            "created_at": "2023-02-08 [07:01:49]",
            "user": {
                "_id": "63e0d342c404541511018188",
                "name": "Kaylin Smith",
                "email": "sjacobs@example.net",
                "email_verified_at": [],
                "password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
                "remember_token": "eGBiWyKKuH",
                "updated_at": "2023-02-06T10:15:30.445000Z",
                "created_at": "2023-02-06T10:15:30.445000Z",
                "posts": []
            }
        },
        {
            "_id": "63e348ddca9468f0dd0e7043",
            "title": "o55onitxgO 7z45oXHh9y8f7Ha",
            "description": "qDsNiNzqIPxWnQSUwtJyDiP45MwNkPF3yWh3TZGQVq34Er8mPg0hW0NFsh1tzlk74YvQ9f9KNlsF1Vf0ooE3GllglsgOzXGpVK9oQ0XWGgZe4aL2Tuk3xoZvgrEiiQn7So8IeMWXBNmlGupZKA4qMmGtrP09oeBbHD4trxz1BXDJtpdR1lhqFMiidRu6qyMR1QpSBJlyIpITxPLPVJF1YQ07GO9Wh57EOBx1HrFvMkBsTooAWgrwU6WqVrGk1hV",
            "user_id": "63e0d43cc404541511019237",
            "updated_at": "2023-02-08 [07:01:49]",
            "created_at": "2023-02-08 [07:01:49]",
            "user": {
                "_id": "63e0d43cc404541511019237",
                "name": "Benton Kuphal MD",
                "email": "elisa.boehm@example.com",
                "email_verified_at": [],
                "password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
                "remember_token": "rTtsVkqKXV",
                "updated_at": "2023-02-06T10:19:40.054000Z",
                "created_at": "2023-02-06T10:19:40.054000Z",
                "posts": []
            }
        },
        {
            "_id": "63e348ddca9468f0dd0e7044",
            "title": "7jxmI8emXX nsDR3i2Rb4mtaa8",
            "description": "0LvRloHxoY6bLvOqzUHqL4i60yOMymvGdiyeaM8yj3zVtigWtZrvcrH45jLD0gfLo0XjjGS0GUlex9m45GFREnyZwNhEJifme5NtLkzRC8STegYxQ4diZLKwVBp9M6R4Mx6G4RbaCKIKm1UZl8CnLI2SJX6E0iacE4LVPb0jMg3UewTfOi0RyE83Ysd1UA9fErwwc9AP03oyz8Ip0bNwev1RBV1VZwguWpaKqAnO0jGCjO0FAm8UoWIbCYR3hov",
            "user_id": "63e0d3b1c40454151101891e",
            "updated_at": "2023-02-08 [07:01:49]",
            "created_at": "2023-02-08 [07:01:49]",
            "user": {
                "_id": "63e0d3b1c40454151101891e",
                "name": "Daija Walker",
                "email": "serena45@example.com",
                "email_verified_at": [],
                "password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
                "remember_token": "rtrthWSzbM",
                "updated_at": "2023-02-06T10:17:21.839000Z",
                "created_at": "2023-02-06T10:17:21.839000Z",
                "posts": []
            }
        },
        {
            "_id": "63e348ddca9468f0dd0e7045",
            "title": "maLFV35t5K aKC4Lt6xOYeSWV6",
            "description": "zL2Y7y1u6kjQMsCeZuySseu5YbygMKJ7sDdLuUgZ4EoKrF6L8xp3lv77OxYtCvu0UQaZN7VKoJXVNSQO05LYeI1BpBzLNth0zz4fX4q9GR9MeKVE717FFFRJFGyDMDKNQT1ycuxtffiUxQKOvUA8x9qEQXDn1q6mFahJgdRdBtRccCMS9OLLN8U2j2ytG5sj5M3o4FEhCtIDG6hH4sikc9ZiRr0gL0aWenBEIgw0yUV0cShtfN0itsHvdB3WvxW",
            "user_id": "63e0d1fdc4045415110171f7",
            "updated_at": "2023-02-08 [07:01:49]",
            "created_at": "2023-02-08 [07:01:49]",
            "user": {
                "_id": "63e0d1fdc4045415110171f7",
                "name": "Lily Gibson",
                "email": "petra.ondricka@example.com",
                "email_verified_at": [],
                "password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
                "remember_token": "WtjZBHPjrW",
                "updated_at": "2023-02-06T10:10:05.934000Z",
                "created_at": "2023-02-06T10:10:05.934000Z",
                "posts": []
            }
        },
        {
            "_id": "63e348ddca9468f0dd0e7046",
            "title": "qVWwLRbCMP Zc6Avm4LVicDo6a",
            "description": "u5K8CGbU9iGafK5waQnN3kgp3vn3s1D5wItauwjP2SrKZcshqlDMJO9baTRwgWZ6Xbdt40RE8WxMnNFFh9dzp53ffV5dciDrqPLrO1f2rUf4N60JCi6mfKkESs4GUgAuFP14N1nGmuTdooPaVVOsfWyOWKhSWlVTMceP7cc86PmdBUGUXxfO7d5OVTp0AsFPm6Q7tcnuzJMNXnxgTNt8XvySmxRtPkWofzZ7crPh6o2YgM8ValU6hWxfdV37Czr",
            "user_id": "63e0d3d3c404541511018b5d",
            "updated_at": "2023-02-08 [07:01:49]",
            "created_at": "2023-02-08 [07:01:49]",
            "user": {
                "_id": "63e0d3d3c404541511018b5d",
                "name": "Vella Nolan",
                "email": "ghoppe@example.net",
                "email_verified_at": [],
                "password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
                "remember_token": "xnsNToMnnS",
                "updated_at": "2023-02-06T10:17:55.983000Z",
                "created_at": "2023-02-06T10:17:55.983000Z",
                "posts": []
            }
        },
        {
            "_id": "63e348ddca9468f0dd0e7047",
            "title": "tBbxwBcb9i ai6H2BVKMnOuT9j",
            "description": "YZgLUiw0UzSVVSKPBs7xvVmiwzR9dSwkcpeBFarP6uTRvo4AcQGB8maQKkTuP7f7f870xrrxLJFX3zJKaLxvewlhmlsYip3LCHhZnQ8WvFk5faFs9yMe31RoZCAjgITiwnLLdYWzn9J7Yf8zWBujIbUGjbgHBxUwTqG9PFWiwbQ0D3DR1b0E3bpvpYQUZvFhULgpUluyumLksPFf66kaqgXq3JsBAb2VVbxvZdBZEsjaLhwwn4vPxU5EzXVjVik",
            "user_id": "63e0d36ec404541511018488",
            "updated_at": "2023-02-08 [07:01:49]",
            "created_at": "2023-02-08 [07:01:49]",
            "user": {
                "_id": "63e0d36ec404541511018488",
                "name": "Janice McClure",
                "email": "fziemann@example.net",
                "email_verified_at": [],
                "password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
                "remember_token": "lb3KqqwjSO",
                "updated_at": "2023-02-06T10:16:14.271000Z",
                "created_at": "2023-02-06T10:16:14.271000Z",
                "posts": []
            }
        },
        {
            "_id": "63e348ddca9468f0dd0e7048",
            "title": "MbA8hhMCc7 cRezsvJYJmg3qnP",
            "description": "grtXwtAztCKRbBTvC9kJKZmRF8DyHwxPsfaQ5fz0IqaKMfAbsMka076sSzJIvJmMX7GHtFHpSeOUS3ZDzJKOxcX3bFLiH7GrwIZTMMHSb3z4yN1L68HHvsh4tl5RwGqcLUVmJZhihL20ocEahwfiRmeFQ5UwKIJBwkdMjiIM6WjJnD9C9vTrJa4IGMTzWtdjIGHcmZmgCSK65axC1DN28ezu1mTYglVCdTqpD5GYoXbH7PwEY2zjrkMAw0a0ceY",
            "user_id": "63e0d364c4045415110183de",
            "updated_at": "2023-02-08 [07:01:49]",
            "created_at": "2023-02-08 [07:01:49]",
            "user": {
                "_id": "63e0d364c4045415110183de",
                "name": "Deshaun Hansen",
                "email": "lockman.charles@example.org",
                "email_verified_at": [],
                "password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
                "remember_token": "O7jM6pgqZn",
                "updated_at": "2023-02-06T10:16:04.562000Z",
                "created_at": "2023-02-06T10:16:04.562000Z",
                "posts": []
            }
        },
        {
            "_id": "63e348deca9468f0dd0e7049",
            "title": "l6tLopSfAi 9s9Wdd7kQUBN01l",
            "description": "yRl3caxqcPOsCSZKeHv2O7Vg7JzXZv2cV7nxf5qJ4tT3SV6RE0Gfmoc1pm3BNLM5Q1nKt6vz5f90ESQHwMaUsGZXB3Lup028BMLpbw4hsnPSVOziuGR8Yf4J3UbdAqVzLQv2GGUZGBAWSPt5PwGwq78Vs4ZgbS2XJiJX1GN6XFQ0TmXbvblDYomsBWi8kHG7NpYwpT5OiCO4qNnI4judJw4gVve94LU7IDrH6gQBPqKsZmeII3iOB7BMdhhdTsO",
            "user_id": "63e0d2c3c404541511017a5e",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": {
                "_id": "63e0d2c3c404541511017a5e",
                "name": "Mrs. Keely Fay",
                "email": "julio.bradtke@example.net",
                "email_verified_at": [],
                "password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
                "remember_token": "9eO60TOQzO",
                "updated_at": "2023-02-06T10:13:23.314000Z",
                "created_at": "2023-02-06T10:13:23.314000Z",
                "posts": []
            }
        },
        {
            "_id": "63e348deca9468f0dd0e704a",
            "title": "6p41bn1ulE pzvOEg7WW0FyqG7",
            "description": "lgRgiNJfWu5hofRSDzGueHCsCLdfGX795ZQYA9engadbgL5PjMySX5KNIP1NalIzvTVZWWONGVYqDYY711R4g1V3KvLC8RweV6VnKLCSC0MrKfgyBZAg44gmCVePjGKcbTj2899otxIw2JdALXXCOHo3v3M61gxVOjh7169rElgKYFnSJN8EeRBjTmkDop4exJ2A9W7cwBr7eUJYpUsiK6Bjbc4qYFgcTqg67nFmLmboy2kvdGkdMo0z4XGxEjP",
            "user_id": "63e0d413c404541511018f8a",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": {
                "_id": "63e0d413c404541511018f8a",
                "name": "Johathan Walter DVM",
                "email": "ykessler@example.com",
                "email_verified_at": [],
                "password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
                "remember_token": "ajGTiXcFgW",
                "updated_at": "2023-02-06T10:18:59.239000Z",
                "created_at": "2023-02-06T10:18:59.239000Z",
                "posts": []
            }
        },
        {
            "_id": "63e348deca9468f0dd0e704b",
            "title": "kCpq3ewmIA 9lG4J5pyZIeOLdL",
            "description": "7pcWS1ggCZP38BVA2T3UZeGVQ6xV3Da4COP9adS2MPm2cfyifwYshGSWU9b5N1DTcGmOoWq3dGj3z7adBW9EXT64KW5ZOzm1mtf7CjbwFB2Avz0Yax6b5iYI2XwcOEK8GZeCu28dvPivy0uvu8k8xhHQOcbPmx2VcBaVntuzmsbXpjMDy5Z8NFYjvw7rOxnoWto7zTFKiBjFCsP295cRO7fc1CRtqrdDwHfE8cES7TtFfvj5dHVNmCwk82c69Z3",
            "user_id": "63e0d394c40454151101871b",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": {
                "_id": "63e0d394c40454151101871b",
                "name": "Christophe Witting",
                "email": "gina57@example.com",
                "email_verified_at": [],
                "password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
                "remember_token": "Ej1HpCzPl4",
                "updated_at": "2023-02-06T10:16:52.118000Z",
                "created_at": "2023-02-06T10:16:52.118000Z",
                "posts": []
            }
        },
        {
            "_id": "63e348deca9468f0dd0e704c",
            "title": "u9tTuE65I8 wsD4dhjT3fSGeBP",
            "description": "zTIlAyfHjD2YpJJeiMnRnFCrhLyYecN6vjTPMg3Ze0ax5MDXxmD4Rf0S4w8chWhHMfEtdhXsBejD0jGaYPsAI8VsQUsORmr69NRm3wzmQqRwW6lB4T5yAs52jvGEgHCwtFVlNDGmasrsHoObYv5nplS24dOhpOJByqM1ORY4XZr6bwUDH93Z7zKPgZR27gH1CNseOoSjVEbik3XC41W6wwH704wnjkCnRkqsUvJWcqTYTzw0fm6BO5MNNvxJCkb",
            "user_id": "63e0d39fc4045415110187eb",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": {
                "_id": "63e0d39fc4045415110187eb",
                "name": "Prof. Jean Berge II",
                "email": "mittie43@example.com",
                "email_verified_at": [],
                "password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
                "remember_token": "aqggS5UQ4I",
                "updated_at": "2023-02-06T10:17:03.802000Z",
                "created_at": "2023-02-06T10:17:03.802000Z",
                "posts": []
            }
        },
        {
            "_id": "63e348deca9468f0dd0e704d",
            "title": "r4wD0ZrEJB XcFgYdPJQeqDFqT",
            "description": "4T6k6wpTtxOhPePvIIFYJmsRYh0gexWSq2Bs1h5k4Co1x2qX1XgN7tox6mIiCpkVbQlEHEj9UHTQQdHkyjW3RaRo2MojV4q1B0zSyRsoSvKgo1PQIvGaNBSn2CIAHedNFXp9jjBlodLZMbDG8zPKNLjRxMorPxDjNH9ehY6dRrLY2HsrmkdV0JD2ZP9NgCKfy0nRaY2HrAnosBI7E7aXXHq55PYvNZex5qmjENhaj6cp5K8v7ZVhPvwYjvxRqSg",
            "user_id": "63e0d3a0c4045415110187f8",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": {
                "_id": "63e0d3a0c4045415110187f8",
                "name": "Dr. Lew Feeney",
                "email": "cheyenne.pfannerstill@example.org",
                "email_verified_at": [],
                "password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
                "remember_token": "deiUNcrK0D",
                "updated_at": "2023-02-06T10:17:04.515000Z",
                "created_at": "2023-02-06T10:17:04.515000Z",
                "posts": []
            }
        },
        {
            "_id": "63e348deca9468f0dd0e704e",
            "title": "MS10SrkeNO 548rTRwzUyn7ScN",
            "description": "O3VNw1Tq18y4i2zbdzgPeQYedpL9f8jhxd0yVtzUaHY3BoRLWt1svR1qIvl2pRElzyrVT4ajvH56G1LKq99SnLrTXmuUQTP1S1C62tr9EubB6bHJB7Ic9W6YK652scIMyj2JtW2TFZDGpe4rJS7p0dZSSzvxFvyimR8rJuNkv3LjzSByMrDbgfcbbhaXYkFTKccEYPA2mtiisPsFbtRAufaVQ21XsjuqbrO16t5tw3AEYClHslfdCFtUK2IqymP",
            "user_id": "63e0d333c404541511018083",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": {
                "_id": "63e0d333c404541511018083",
                "name": "Dr. Leonora McClure IV",
                "email": "dee.lemke@example.com",
                "email_verified_at": [],
                "password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
                "remember_token": "fipvuEOtWG",
                "updated_at": "2023-02-06T10:15:15.403000Z",
                "created_at": "2023-02-06T10:15:15.403000Z",
                "posts": []
            }
        },
        {
            "_id": "63e348deca9468f0dd0e704f",
            "title": "GtTrh1qXl3 p3jdOBFZkmzBGJB",
            "description": "dA0sQ0uY3ixJfH890l4hYuKQAvO6Zpjr0n4BWIyrP7vXVO71frLw8MyjudGkfR9rkQyoEX43gPTM0ItEciEpO8hcyZE1K8yZ18tmyU6rpAuAOG1PQWmW3KgBkhQ2yuuqqqXiwSceqSaliPIsyGYx7yhEsHGftqkdPpiwciQtg15x8BCarqpwjsHZUz2kUzNgfM6uApJS7hT08aeg7Hf54vUHFSKzE48v4XcmMrUg5mEfEAvkjjGKQU6s5cFp8lQ",
            "user_id": "63e0d34fc404541511018273",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": {
                "_id": "63e0d34fc404541511018273",
                "name": "Gunnar Paucek",
                "email": "turcotte.kyla@example.com",
                "email_verified_at": [],
                "password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
                "remember_token": "Tes1jdGli8",
                "updated_at": "2023-02-06T10:15:43.849000Z",
                "created_at": "2023-02-06T10:15:43.849000Z",
                "posts": []
            }
        },
        {
            "_id": "63e348deca9468f0dd0e7050",
            "title": "B8ceaOetg8 dNhth8QrBoVUZGT",
            "description": "257qYoxJ6ccHUkeLDyz4WUzkWUTIqFKSox14fnfMBSOsVT9M6QVOFakaxjfFwhkewKTN7VP3N2lJo93LdreT5zJeSInfzpV41Ijq5Fk036c8ZqoVyY5xQSprMB7dTB2NpfvnhCTDRHOj7PXJVXfVtrqReZHLl9evcTpHHXjcYLcl8ROP8fEub2yjw6yRxRaGmTpDurdNhFW7GRcPZ6evAtz7nX7TOLDiL2d45CXXifCloJ6Sgy2b92EiNP7OP4B",
            "user_id": "63e0d428c4045415110190f3",
            "updated_at": "2023-02-08 [07:01:50]",
            "created_at": "2023-02-08 [07:01:50]",
            "user": {
                "_id": "63e0d428c4045415110190f3",
                "name": "Cristian Kunze",
                "email": "ward.jake@example.net",
                "email_verified_at": [],
                "password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
                "remember_token": "bT3PnDIrV7",
                "updated_at": "2023-02-06T10:19:20.473000Z",
                "created_at": "2023-02-06T10:19:20.473000Z",
                "posts": []
            }
        }
    ],
    "first_page_url": "http://127.0.0.1:8000/api/api/posts?page=1",
    "from": 1,
    "last_page": 67,
    "last_page_url": "http://127.0.0.1:8000/api/api/posts?page=67",
    "links": [
        {
            "url": null,
            "label": "« Previous",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=1",
            "label": "1",
            "active": true
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=2",
            "label": "2",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=3",
            "label": "3",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=4",
            "label": "4",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=5",
            "label": "5",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=6",
            "label": "6",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=7",
            "label": "7",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=8",
            "label": "8",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=9",
            "label": "9",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=10",
            "label": "10",
            "active": false
        },
        {
            "url": null,
            "label": "...",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=66",
            "label": "66",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=67",
            "label": "67",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/api/posts?page=2",
            "label": "Next »",
            "active": false
        }
    ],
    "next_page_url": "http://127.0.0.1:8000/api/api/posts?page=2",
    "path": "http://127.0.0.1:8000/api/api/posts",
    "per_page": 15,
    "prev_page_url": null,
    "to": 15,
    "total": 1000
}

Sorry for such a long post. But, I was wondering if you'll be able to fix this issue or maybe provide a workaround for this issue.

Thank you

anushanw commented 1 year ago

@gg-aditya sorry about the delayed reply on this. Instead of

return Moldssp::paginator(Post::with('user'), $request)

can you try to use the below:

return Moldssp::paginator(Post::with(['user']), $request)

This is passing the "with" values as an array instead of a string. So basiscally use square brackets aroung 'users' inside with.

Let me know if this works.

gg-aditya commented 1 year ago

@gg-aditya sorry about the delayed reply on this. Instead of

return Moldssp::paginator(Post::with('user'), $request)

can you try to use the below:

return Moldssp::paginator(Post::with(['user']), $request)

This is passing the "with" values as an array instead of a string. So basiscally use square brackets aroung 'users' inside with.

Let me know if this works.

Hi! Thank you for your response. I tried adding 'square brackets' as you suggested. However, I'm still getting the same result as before. The relationships simply just won't load.

return Moldssp::paginator(Post::with(['user']), $request)