To specify columns for both the orders table and the relationships, you can use the select method on the relationship itself. Here's an example of how you can modify your query to achieve this:
$this->orders = Order::with(['category' => function ($query) {
$query->select('id', 'name');
}, 'assignee' => function ($query) {
$query->select('id', 'name');
}])
->select(['id', 'title', 'status', 'priority'])
->get();
In this example, we are using the with method to eager load the category and assignee relationships. Inside the closure for each relationship, we use the select method to specify the columns we want to retrieve from the related table.
Note that you need to use the array syntax (['category' => function ($query) {...}]) when eager loading relationships with specific columns.
This modified query will retrieve only the specified columns for both the orders table and the related tables.