php - Laravel DB::RAW fetch single -
I am using a quote query in Laravel .. because this query is a bit complicated with builder or lucrative.
I ask the database for 1 person, from where I am using it. The returned result is an array, with something in it .. (see screenshot) From which I get the following error: which is telling me that it is not applicable for such queries first .. Thanks! It is such that you believe in the eLocation that If you need to set up more data, instead I will create a DB view for this. How do I get only the first result? I have tried
return data $ ['person'] = db :: select (db :: raw ($ person)) [0];
Feedback content A string or object should implement __toString (), "Object". Return Data ['Person'] = DB :: Select (DB :: Raw ($ person)) - & gt; First ();
this is the query
SELECT Companies on JOIN companies from nickname, firstname, lastname, age, title, photo, companies.name, cities.name, trickshot people.ind = persons.company_id Join cities in cities.id = companies.city_id where CONCAT (first name , Last name) = '{$ Fullname}' and cities. Name = '{$ city}'
person The model is:
person :: Select (.., 'company.co.name as company', 'city as cit.name') - & gt; Join ('companies as companies', 'comp.id', '=', 'individuals.company_id') - & gt; ('Cit.name', $ city) - & gt; Where (DB :: Raw ('Cockat (First Name)' ('CIT', '=', 'Comp., Last Name)'), $ Full Name) - & gt; first ();
Comments
Post a Comment