Skip to main content

All Questions

Tagged with
-4 votes
2 answers
105 views

Convert this Eloquent model function to a MySQL query? [closed]

I need to convert this Eloquent Model Function to a MySQL Query: public function currentPrice(): HasOne { return $this->hasOne(Price::class)->ofMany([ 'published_at' =>...
Michael Kocurek's user avatar
1 vote
0 answers
99 views

How to Eager Load Aggregated Fixtures from Original and Duplicated Competitions in Laravel?

I'm working with a database design where competitions can be duplicated, and I need to efficiently query original competitions along with aggregated fixtures from both the original and duplicated ...
Erfan Shokouhi's user avatar
0 votes
0 answers
54 views

How to prevent race condition laravel 11 [duplicate]

I have a table named gym_sessions it has user_id | status columns. status column can contains: 1 ==> active; 2 ==> completed; 3 ==> declined; Conditions: User must have sufficient balance to ...
Ahmed Laggoun's user avatar
0 votes
0 answers
27 views

MySql CTE/recursive relationship query

I have these tables: products (infinitely nested) id parent_id links: id product_id user_follows_link user_id linkd_id I would like to write a query that returns the products that have links ...
Hillcow's user avatar
  • 979
0 votes
0 answers
72 views

Laravel Auth::user() is extremely slow (2.7s query time) how to optimize it? [duplicate]

I am experiencing an extremely slow query when calling Auth::user() in Laravel. The query takes around 2.7 seconds, which significantly slows down my application. I logged the database queries using ...
Antonio De Simeis's user avatar
0 votes
0 answers
33 views

Laravel SQLSTATE[HY093]: Invalid parameter number" but query works? [duplicate]

I'm new to Laravel but I'm trying to query locations based on bounding box of google map. When I run the page I get the following error: "SQLSTATE[HY093]: Invalid parameter number (SQL: select `...
Barkster's user avatar
0 votes
0 answers
23 views

laravel application with proxysql and mysql8 say NO_AUTO_CREATE_USER [duplicate]

I have mysql group replication and proxysql, now when I connect multiple laravel projects with proxysql they all say SQLSTATE[42000]: Syntax error or access violation: 1231 Variable 'sql_mode' can't ...
Mujtaba Tarar's user avatar
0 votes
1 answer
81 views

Why does database keep dropping when running MySQL in container?

For context I am running a PHP Laravel web app using Laravel Sail on a digital ocean droplet with 2GB memory. The problem I'm running into is that after running for a certain amount of time (seems ...
NicLovin's user avatar
  • 355
0 votes
1 answer
115 views

Tenancy for Laravel v3 not creating database

I need separate databases for each deployments (tenants). public function store(Request $request) { Log::info("Starting deployment creation for slug: " . $request->slug); // **...
GunJack's user avatar
  • 1,978
0 votes
1 answer
76 views

How to Fetch Chat Data Using Eloquent with Joins?

I'm trying to fetch chat-related data using Eloquent in Laravel 11 but I'm struggling to structure an optimized query using Eloquent relationships or joins. I have two MySQL tables: users -> id, ...
Uzair Usman's user avatar
1 vote
1 answer
60 views

Laravel Database Connections Not Closing with Apache2 on AWS ALB (EC2 Target Group)

I'm running a Laravel application hosted on an AWS EC2 instance, using Apache2 as the web server. The setup includes an AWS Application Load Balancer (ALB) directing traffic to the EC2 instance. Issue:...
Ravi Kyada's user avatar
1 vote
1 answer
47 views

Laravel 8 Multiple Image Upload and store in mysql

I need to store image in DB and folder , but my code store only one image and I want to store multiple image . I use Laravel 8. This is my controller public function store(Request $request) { $...
pape's user avatar
  • 249
0 votes
0 answers
108 views

Serialization deadlock on upsert in Laravel with concurrent console commands

I need some help improving the performance of my Laravel 11 upsert query. I'm pulling thousands of entries in chunks from a Redis 7 stream and upserting into my MySQL 8 database. It's an aggregated ...
Ryan H's user avatar
  • 3,005
0 votes
0 answers
44 views

SQLSTATE[42000]: Syntax error or access violation: 1148 Unable to parse: use DB_Name;

I'm encountering an error while trying to connect to a MariaDB cluster using a load balancer IP in my Laravel application. The error message is: SQLSTATE[42000]: Syntax error or access violation: 1148 ...
Jayan Dholariya's user avatar
1 vote
1 answer
88 views

How to set a default value of 1 year from now for expire_at in Laravel migrations? [duplicate]

I am creating fields for a table in Laravel. I want to create a expire_at column using $table->timestamps() but set a default date of 1 year from now. Currently, I am trying the following: $table-&...
Malik Muhammad Awan's user avatar

15 30 50 per page
1
2 3 4 5
1113