Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
53 views

I am trying to retrieve category (id, category_name, status) table data using where condition and sort in descending order for id. I am writing query like:: public function category() { $...
nischalinn's user avatar
  • 1,284
1 vote
1 answer
80 views

I am new for Eloquent Query Builder and I have some questions: Goal: Create a query that will get me recipes that match the specified parameters from selectors: Dish Category Dish Subcategory Cuisine ...
Dmytro Shved's user avatar
0 votes
2 answers
84 views

Joining multiple tables in Query Builder is so simple: DB::table('projects') ->select('tasks.*') ->join('tasks', 'tasks.project_id', 'projects.id') But for now customer asks me to avoid join ...
vbulash's user avatar
  • 395
0 votes
2 answers
45 views

I use parameterized query in Laravel: $objectsSQL = <<<'EOS' SELECT o.id AS oid, o.name AS name, o.fields AS fields FROM projects p JOIN tasks AS t ON t.project_id = p.id LEFT ...
vbulash's user avatar
  • 395
-1 votes
1 answer
48 views

I`m using postgres 17.2 I have transactions table with morph columns entity_type and entity_id. When i use whereHasMorph i got a type error with entity_id because users table id is bigint Example: $...
EyeVers's user avatar
0 votes
0 answers
16 views

I run a validation rule on a combination of 3 fields (f_name, s_name, l_name) to make sure the combination is unique in an institution, but the rule fails and don't apply until the third entry after ...
Mahmoud Awad's user avatar
1 vote
1 answer
44 views

I have the following models/tables: branch: id - integer department: id - integer teacher: id - integer branch_department_id - integer branch_department: id - integer ...
MOHAMMAD RASIM's user avatar
0 votes
2 answers
105 views

When updating my cart model, I run: $cart->transaction_id= $result->salePaymentRequestResult->token; $cart->save(); This does update my cart. But it with different value. Why is my model ...
Hossein Azad's user avatar
0 votes
1 answer
135 views

I have a Place, User models with a many to many relationship as the pivot table / model named Reservation, I needed to make a new relationship between the pivot table and another table called ...
Mousa Alfhaily's user avatar
2 votes
4 answers
338 views

I am trying to do union with DB query builder because with models is not working the union with paginate/cursorPaginate. I have this but give an SQL error because Laravel is not building the right ...
Maximiliano Sosa's user avatar
1 vote
0 answers
94 views

I want to get the average time from one a patient came to when they had their first vital signs checked. It means that I have to check the time the visit was initiated (created_at) against the ...
Zuby's user avatar
  • 53
0 votes
1 answer
51 views

So this is the query I have constructed so far $data['requested_units'] = RequestedUnit::with([ 'user', 'agent_warrants' => function ($q) { $q->where('type', RequestedUnit::...
Arsalan Khan's user avatar
0 votes
1 answer
86 views

I'm trying to use Laravel each method inside a with in my query builder but the attribute I'm adding inside my each method does not persist to the collection. My attribute does show when I dd($task); ...
dfeva's user avatar
  • 65
0 votes
1 answer
24 views

I'm trying to understand how I can create a query with query builder and have a where value something like where item=1 and GETDATE() BETWEEN date1 AND date2 Thanks.
Steve's user avatar
  • 51
1 vote
1 answer
170 views

I'm attempting to join a subquery into a main query using the Laravel Query Builder in a context similar to the example below. I assumed that the main query would recognize this by specifying the ...
James's user avatar
  • 21
0 votes
0 answers
155 views

I'm encountering an issue with GitHub authentication in my Laravel app using Laravel Socialite. Despite setting up everything correctly and being able to retrieve user data from GitHub, users aren't ...
Ssionn's user avatar
  • 1
0 votes
1 answer
46 views

I have a query I use to filter results according to user profile. I have a list of countries applied to model, and I show only those where user.country matches with this array. This part works fine to ...
Denys Siebov's user avatar
0 votes
1 answer
75 views

$table->unsignedBigInteger('creater_id')->nullable(); $table->string('creater_type')->nullable(); $table->unsignedBigInteger('updater_id')->nullable(); $table->string('...
Shariful European IT's user avatar
0 votes
1 answer
89 views

I am trying to return a single id from a query result. When I dump the query using the \DB::getQueryLog(), it shows the correct query. And when I plug the query into my DB manager, it returns the ...
Skittles's user avatar
  • 2,918
0 votes
1 answer
286 views

I have multiple tables with millions of records, and I'm facing performance challenges with my current Eloquent queries. I have three tables = 'sales', 'expenses', and 'profits' Each table has ...
Harshad Kanani's user avatar
0 votes
0 answers
264 views

I am using Laravel 5.7 and have a query written using Eloquent. I am attempting to convert it into an equivalent Query Builder query to enhance performance. However, I am facing difficulties when ...
Ngọc Đô Đinh's user avatar
0 votes
0 answers
92 views

"I want to create a filter where the data is taken from nested JSON." Previously, I had a table named history_product with the column transaction_details. I want to create a filter based on ...
Roni Surya's user avatar
0 votes
2 answers
86 views

i'm trying to update event name through postman with the following json object: PUT {{base_url}}events/1 { "name":"this Event Name is Edited" } in my controller i'm using ...
Aasem Shoshari's user avatar
-1 votes
1 answer
57 views

Imagine I had 4 models as follows: Year Position PositionAllowance : This is a pivot table of Position and Year, with the addition of "allowance" i.e. it defines the amount of allowance for ...
rifqy abdl's user avatar
0 votes
1 answer
93 views

I'm facing an issue with grouping and selecting rows based on the maximum date in Laravel using Eloquent. I have a table named AlertsLog with columns id, price, and created_at. The goal is to group ...
Yashgupta's user avatar
  • 221
0 votes
0 answers
37 views

I have query: $query = Task::query()->select(['tasks.*', 'rootTask.is_public as rootPublic']); $query->leftJoin('tasks as rootTask', function ($join) { $join->on('tasks._lft', ...
Stanislau Karaliou's user avatar
0 votes
0 answers
116 views

I have a big laravel project that contains a lot of deletion in that project, in all of those deletion didn't put alert before deleting, now I can't modify the project one by one and adding alert or ...
Sina Ghoshuni's user avatar
-1 votes
2 answers
74 views

I want to filter records with relation which has another relation with conditions and with count > 0 Code: $classClass = ClassClass::query() ->with('parent') ->with('...
Алексей Ягодаров's user avatar
1 vote
1 answer
118 views

I want to take this SQL query to a query in Laravel Query Builder. It is important that the result be of type Query Builder. Please if you can help me. SELECT MAX(sub.total) as total, sub.vendedor ...
Efratista's user avatar
-1 votes
1 answer
135 views

i have an Entity that contains morph relation to represent relation with different Entities. for example use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity */ class BinderContent { /** * @...
Bebo's user avatar
  • 5
0 votes
0 answers
52 views

The query builder is producing the following query. Everything is correct except for how the parameters are populated: select `citations`.*, ( select sum(`settlements`.`amount_dollars`) ...
Jay Bienvenu's user avatar
  • 3,417
0 votes
3 answers
584 views

I'm trying to convert a json column name with path 'foo->bar' to be compatible with mysql/postgresql using Laravel's wrapJsonSelector() method. How can I access this method from the query builder ...
John Magnolia's user avatar
0 votes
1 answer
63 views

I have a following MySQL table: id days_remaining final_date 1 4 2023-10-01 2 10 2023-10-01 I'm trying to mass update the final_date column. The resulting value of this column is a fixed date value eg:...
sohal07's user avatar
  • 482
0 votes
1 answer
112 views

I am trying to merge query into one, is there's anyway to avoid if statement and merge the query into one query? Each organization has different specialties, which works great in the first query, i ...
Waleedviews's user avatar
0 votes
0 answers
52 views

Thank you all in advance , i have peoject for ecommerce app please check simplified DB schema for better unsrstand products - id - name - some other columns ... product_items - id - product_id - some ...
Amr mahmod's user avatar
0 votes
0 answers
27 views

I can access my holder class data but i can't seems to access data that is coming from devices table. i have used postman to check my api and it return the data ok and also when i print_r the data on ...
Sanan Abid's user avatar
0 votes
1 answer
41 views

I'm facing an issue while trying to retrieve entries using Eloquent that meet specific criteria involving filtering on two related models. The goal is to first select reservations with a "Checked-...
Xiaofan's user avatar
  • 13
0 votes
0 answers
55 views

i'm facing this problem where i must show only data related to the region that the current user belongs to, but if you're let's say the global manager of the solution you could see all of the data. i'...
Test Laravel's user avatar
0 votes
1 answer
112 views

My question is similar with NodeJS get only value of MongoDB result. But in this case, i'm using laravel. This is my controller : public function validation(Request $request) { $email= $...
Januar's user avatar
  • 111
-1 votes
2 answers
35 views

I have table with records. In table i have column 'payment_date', and it's integer with unix timestamp. I need to select records from the database that are in the time interval of two days for each ...
Sergey S.'s user avatar
  • 157
0 votes
1 answer
174 views

I want to get each employees task count in a month and integrate into bar chart,i managed to get total count of tasks based in a month i am confused how to do that user based,let's say i have 10 ...
Abhijith's user avatar
  • 2,337
2 votes
0 answers
334 views

I am trying to achieve a result using Laravel Union. [ { warehouse_id: 12, warehouse_name: "new", wi_id: 19, wi_type: "storage", wi_name: "1", wr_id: 20, ...
Sharif's user avatar
  • 106
0 votes
2 answers
203 views

I have an inventory system with bins, lots, and transactions. Bin: has many lots Lot: belongs to a bin belongs to many transactions transaction_lot (pivot) - quantity Transaction: belongs ...
Erich's user avatar
  • 2,646
0 votes
2 answers
759 views

As @JonasStaudenmeir answered on laravel eager loading with limit, which query looks like: User::select('id') ->with([ 'posts' => fn($query) => $query->select(['id', 'user_id'])...
JS TECH's user avatar
  • 1,583
2 votes
1 answer
1k views

How can I properly bind an array for a raw query's NOT IN / IN? The following throws an array to string conversion error: $user_list_to_exclude = [1, 2, 3]; $data = DB::select("...
pileup's user avatar
  • 3,462
1 vote
1 answer
372 views

I want to split a Laravel query result at the end of the query after doing some common query in the beginning. Scenario, code smple and my try is given below. Code sample $bankSlipIds = [1,2,3]; $...
Md. Amin Hossain's user avatar
0 votes
1 answer
104 views

Hi I am using Laravel 10 . My issue is not able to use orderby() with distinct(). I am using PostgreSQL as database. When I tried Group_by , I am getting repeated results. I have tried many solutions ...
Yadhu Babu's user avatar
  • 1,509
0 votes
1 answer
43 views

A project has multiple task. A task is belongsTo a project A task is belongsTo a user, and a user has many tasks A user have an avatar So I can get the users thats belongs to the project through the ...
Telexx's user avatar
  • 731
0 votes
1 answer
97 views

The following code checks the whether subscriber can access the property or not. If property subscriber_id == current subscriber id, can access it. If property subscriber_id within linked offices ...
Govinda Lohani's user avatar
0 votes
2 answers
229 views

I am working on a project and I needed to retrieve data from an Table A to Table C with a Table B as an intermediate using the HasManyThrough from Laravel Doc Has Many Through. I have three Tables ...
MOHAMED KESSOUM's user avatar

1
2 3 4 5
31