I\'m confused as to when ->get()
in Laravel...
E.G. DB::table(\'users\')->find(1)
doesn\'t need ->get() to retrieve the results, neither
find(n)
, you retrieve a row based on the primary key which is 'n'.first()
, you retrieve the first row among all rows that fit the where clauses.get()
, you retrieve all the rows that fit the where clauses. (Please note that loops are required to access all the rows or you will get some errors).