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)

 Enter image details here

How do I get only the first result? I have tried
  return data $ ['person'] = db :: select (db :: raw ($ person)) [0];   

From which I get the following error:
Feedback content A string or object should implement __toString (), "Object". Return Data ['Person'] = DB :: Select (DB :: Raw ($ person)) - & gt; First ();

which is telling me that it is not applicable for such queries 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}'   

Thanks!

It is such that you believe in the eLocation that 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 ();   

If you need to set up more data, instead I will create a DB view for this.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -