Created
September 4, 2019 17:22
-
-
Save novaknole/e3a80c3dc4fc9ef318d666311abc73be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$vehicle = App\Http\Models\Vehicle::findOrFail(2); | |
return $vehicle->with([ | |
'latestPrice' => function($query) { | |
$query->where('milleage', 1000)->latest('id'); | |
}, | |
'latestDamage' => function($query){ | |
$query->where('user_id', 1)->latest(); | |
}, | |
'latestDamage.images' | |
])->first(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment