guys, I'm trying to get the last element from the data returned to me but the problem is that it is throwing me an error which is
Call to undefined method Illuminate\Database\Query\Builder::last()
Here is my code
$last_saved_snapshot = \EnginePerformanceTestSnapshot::where('engine_performance_test_id', $id)->last();
Please tell me what is it that I'm doing wrong. Thanks
P.S I'm using Laravel 5.0
Try something like that:
$last_saved_snapshot = \EnginePerformanceTestSnapshot::where('engine_performance_test_id', $id)
->get()
->last();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With