Hello, what I am trying to do is bring all the records of my table but the field that I want to bring is only "table_name", I have made the following query using Eloquent, my question would really be what is the best way since I have read that some queries can be more optimized than others. And how can I know this? This is my query with Eloquent:
CatAdministrator::all()->pluck('table_name');
If the method
all()
does not specify the columns from which you want to retrieve the values, then it will do a general selection.Then you can write it like this:
The output produced would be something like this:
However, if you use a
pluck()
in this way:The output produced would be:
Final comments:
pluck
, which does not seem practical.