K
K
kaxa32012019-11-22 10:25:09
Laravel
kaxa3201, 2019-11-22 10:25:09

How to return only number without key?

$model->select(\DB::raw('COUNT(id)'))->first();
this query outputs "count": 6
How to display only the number 6?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Kolesnikov, 2019-11-22
@kaxa3201

$model->count();
?

N
netrox, 2019-11-22
@netrox

DB::selectOne('');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question