Select second last record with Laravel - eloquent
or try this one
DB::table('transition')
->where('transition_id', '<=', $id)
->orderBy('transition_id', 'desc')
->skip(1)
->first();
second to last for unique column
DB::table('transition')->where('transition_id', '<=', $id)
->orderBy('transition_id', 'desc')
->skip(1)
->take(1)
->first();
Try this:
transition::orderBy('created_at', 'desc')->skip(1)->take(1)->get();