jeudi 12 novembre 2020

get value from database in string using query builder

so in controller I am getting a value from a input form in string i.e. product_name

return $request->input('product_name');

And on the behalf of this I want to get product_id of that product from database table using query builder

return category::where('product_name',$request->input('product_name'))->get('product_id');

problem is, I am getting the value in array form but i want this value in string

//output

[{"product_id":7}]

but i want it in string like

7

please help to achieve this in single line using query builder, thanks in advance



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/35lOgRd
via IFTTT

Aucun commentaire:

Enregistrer un commentaire