Reputation: 1
Here I am displaying my JSON. What is the best way for me to go through the data and display ID and Seat_name for each at the same time?
this is the output i am looking for
Upvotes: 0
Views: 45
Reputation: 34708
You can use select
method to select specific column data :
$availableSeat = Seat::select('id', 'seat_name')->where('status', 0)->get();
Or, you can do with on get()
method as like :
$availableSeat = Seat::where('status', 0)->get(['id','seat_name']);
Upvotes: 1