3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-05-06 06:35:23 +00:00

Updated withCount to use manual naming

This commit is contained in:
snipe
2019-05-22 00:52:51 -07:00
parent df8008f1ed
commit 4be8ba9f17
17 changed files with 29 additions and 30 deletions

View File

@ -341,7 +341,7 @@ class AssetsController extends Controller
*/
public function show($id)
{
if ($asset = Asset::with('assetstatus')->with('assignedTo')->withTrashed()->withCount('checkins', 'checkouts', 'userRequests')->findOrFail($id)) {
if ($asset = Asset::with('assetstatus')->with('assignedTo')->withTrashed()->withCount('checkins as checkins_count', 'checkouts as checkouts_count', 'userRequests as userRequests_count')->findOrFail($id)) {
$this->authorize('view', $asset);
return (new AssetsTransformer)->transformAsset($asset);
}