dimanche 30 juillet 2017

Laravel 5.2: passing session in a where clause

I am using Laravel 5.2 and trying to pass an existing session in a where clause:

The session called currentOrderReference works as expected and its value is: 31GENERND2342
If I try to get the customer_id using following query, the query does not return any customer_id:

$ref = session()->get('currentOrderReference');
Order_reference::select('customer_id')->where('reference',$ref)->first();

But if I replace the var $ref with its value like this, then it works

Order_reference::select('customer_id')->where('reference','31GENERND2342')->first();

What I am doing wrong in the first query?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2uLfrTp
via IFTTT

Aucun commentaire:

Enregistrer un commentaire