Skip to content

Tag: laravel

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…

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 nul…

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