A memory exhaustion happens when I run my DB seed script in production. Below is my seed script. So what I did was add a no-limit on my seed script. The problem now is that when I run the script it logs the output into the terminal the content of the SQL script (which is very, very big). Is there
Tag: eloquent
two foreign keys, how to map with laravel eloquent
I have two tables in MySQL, where the first one is called users and the second one is called games. The table structure is as follows. users id (primary) email password real_name games id (Primary)…
Counting related rows in a child table
I have been trying to do some queries and getting a count on related tables using eloquent. Tables: requests contact (belongs to requests) history (belongs to contact) As such X number of requests each have Y number of contacts which in term each have Z number of histories Using sql I can do something like this to get all the
Laravel foreign key onDelete(‘cascade’) not working
I have a many-to-many relationship between User & Role, with a role_user table. My migrations are setup as so (simplified): users table: public function up() { Schema::create(‘users’, …
Laravel Eloquent to join table and count related
How do I use join with Eloquent taking in consideration the following table structure: I have a properies table ——————— ID | Name ——————— 1 | Property Name than …
How do I get the query builder to output its raw SQL query as a string?
Given the following code: I want to get the raw SQL query string that the database query builder above will generate. In this example, it would be SELECT * FROM users. How do I do this? Answer To output to the screen the last queries ran you can use this: I believe the most recent queries will be at the