--- title: 'You can manually set the relation of a model using `setRelation` method' tweet_id: '1555543660678156288' thread_slug: weekly-thread-2022-31 author_username: freekmurze images: - 'https://pbs.twimg.com/media/FZUmDyfXkAY7qyU.jpg' created_at: 2022-08-05T13:18:03+00:00 slug: you-can-manually-set-the-relation-of-a-model-using-setrelation-method --- Eloquent’s `setRelation` is a very powerful method when used well. Here’s how I used it to solve a performance problem in @OhDearApp https://freek.dev/2311-increase-performance-by-using-eloquents-setrelation-method #laravel #php #performance