Skip to content
Advertisement

Tag: laravel

How to use REPLACE with WhereRaw eloquent laravel?

I have a column in my database that saved with double quotation (“) now I want to replace it by space.I’m using REPLACE and whereRaw.but It dosent work. this is my code: actually using / for scaping (“).Any Idea? Answer I believe you found the answer in the comments another thing what I suggest is don’t append the value directly

1064 You have an error in your SQL syntax; check the manual … for the right syntax to use near ‘WHERE reviews.yes_no = yes

I want to optimise the queries on my project and after many tentatives of using eager loading with datatables i just give up because there was no query reducing at all. Anyway now Im trying to achieve that using join, but the problem is that using WHERE clause in DB::RAW it gives me the following error: “Exception Message:nnSQLSTATE[42000]: Syntax error

Eloquent hasMany doesn’t load collection

I’m relatively new to eloquent, and have problems loading data from a hasMany relation in an app that uses eloquent as the database layer. My (simplified) code is as follows: The SQL Schema is like below I then do the following query: This results in a json like the following Raw SQL query shows me that I do have data

All the migrations are working inappropriately

This is the error I get after trying to open the form. Below are the codes. It takes me all day so please kindly help me out. SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘id’ in ‘field list’ (SQL: select max(id) as aggregate from admissions where admissions.deleted_at is null) Here is the migration Answer This represents that your primary key

MySql Group By Count item count Distinct

I have a table looks like Here user id 1 exist in level 1 and level 2 Now when we count group by level then in counting we want ignore user_id 1 from level 1 cause it exist another group. we want to consider only one group existing and higher group. I have done only group count but cant understand

Advertisement