inertia-laravel icon indicating copy to clipboard operation
inertia-laravel copied to clipboard

[1.x] Exclude properties from partial responses

Open lepikhinb opened this issue 9 months ago • 2 comments

The PR introduces an ability to exclude properties from partial responses. The except option can be used together with only to refine nested props.

The corresponding client-side PR: https://github.com/inertiajs/inertia/pull/1876

router.visit(url, {
  only: ['auth'],
  except: ['auth.user'],
})
$props = [
    // Included on partial reload
    'auth' => [
        // Excluded from partial reload
        'user' => new LazyProp(function () {
            return [
                'name' => 'Jonathan Reinink',
                'email' => '[email protected]',
            ];
        }),
        // Included on partial reload
        'refresh_token' => 'value',
    ],
    // Excluded from partial reload
    'shared' => [
        'flash' => 'value',
    ],
];

lepikhinb avatar May 14 '24 00:05 lepikhinb

Please make sure to mark this as ready for review if you need one.

driesvints avatar May 14 '24 08:05 driesvints

@driesvints just want to get the client PR ready first

lepikhinb avatar May 14 '24 09:05 lepikhinb