How to get value after DB select and DB raw in laravel

Viewed 601

How can i get the string after call this DB function in laravel?

DB::select(DB::raw('select uuid_short()'))
2 Answers

Try this

DB::select(DB::raw('select uuid_short() as uuid'))[0]->uuid

Shorter way could be;

DB::selectOne(DB::raw('select uuid_short() as uuid'))->uuid

Other one;

DB::select(DB::raw('select uuid_short() as uuid'))[0]->uuid
Related