Quantcast
Channel: User Mohamed Mufeed - Stack Overflow
Viewing all articles
Browse latest Browse all 36

Answer by Mohamed Mufeed for Select only first cell in first cell using Laravel query builder

$
0
0

I know its old, but still - The query builder have a handy method called value. This is actually what you are looking for.

// The value of column_1 of the first matched result where column_2 is 'somthing'$my_value = DB::table("my_table")    ->where("column_2", "=", "something")    ->value("column_1")

And it also works with models

$my_value = MyModel::where("column_2", "=", "something")->value("column_1")

Viewing all articles
Browse latest Browse all 36

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>