All Tag: laravel Posts

    Craig Riley

    3 months ago - Development

    Laravel forms: casting an input before validation

    If you’re familiar with casts in Laravel, you’ll know them as a great way to transform values on their way to and from the database. A boolean cast – for example – is stored in the database as a 1 or a 0, whereas inside your code, it will be true or false. But what...

    Craig Riley

    3 months ago - Development

    Adding a cache layer to Inertia SSR in Laravel

    Inertia’s SSR server (which runs in a NodeJS process) is pretty quick, but sometimes you’re trying to shave every millisecond possible off your render time. A common question we’ve encountered is whether you can simply cache the server response and speed things up even more. Good news: you can. What makes this possible is a...

    Craig Riley

    5 months ago - Development

    Inverse BelongsToThrough relationships in Laravel models

    No, Laravel doesn’t actually have a BelongsToThrough relationship, a common frustration for models where you want to access the top level of a BelongsTo chain. Consider this setup: A user has authored many posts. Those posts have many reviews. So how do we define the inverse relationship back up from Review -> User (the post...