Support the ongoing development of Laravel.io →

4,314 Threads

[Laravel 5][Eloquent ORM] Pivot table from one table result

In all examples I see pivot with tables relationship. Is it possible: I have result from one table [...

0 Likes
0 Replies

Laravel getting tag use count per user with eloquent or DB facade

Laravel 5. I have 3 related tables. **Posts** user_id ... ... **Users** id ... ... **Tags** id nam...

0 Likes
1 Replies
posted 11 years ago

Order by number of relations

Hi, it may be an evident question but i can find the answer in the documentation. who can i order a...

0 Likes
3 Replies
posted 10 years ago

Complex Relationship/Model help, best way to link three or four tables?

Hello, I have a four different tables/models I'm trying to define relationships for and am having tr...

0 Likes
0 Replies

Relationships to JSON?

So i have User model and Articles model. When i return User::all()->toJson(); i get only user atr...

0 Likes
4 Replies
Solved

Multi Tenancy

So, I got sick of reinventing multi tenancy over and over again. I got so sick of it in fact, that I...

0 Likes
2 Replies

Issues in counting user login on every login.

Hi gues i am working on a login functionality that increments the "no of login times" tabl...

0 Likes
7 Replies
Solved

Question regarding aggregate in Query Builder

I am querying a table and I wonder why Laravel make a count(*) query before my query that spend addi...

jeanali liked this thread

1 Likes
5 Replies

Model relationship Eloquent (newbee)

Hi Guys, I'm recently decided to make a switch to start coding with Laravel. I will try to specify m...

0 Likes
2 Replies

attach() throws error when given array of ids with additional pivot data

Example in the docs: $user->roles()->attach([1 => ['attribute1' => 'value1'], 2, 3]); So...

0 Likes
0 Replies

convert query mysql to Eloquent?

Hello, I need convert query from mysql to eloquent mysql Query SELECT count('id_sale') FROM sales J...

0 Likes
0 Replies

Eloquent where 'and', 'or' statement

I'm trying to write this first piece of line in Laravel. I thought I got it right, but not. I hope t...

0 Likes
1 Replies
Solved

Check if form has posted Laravel 5

I'm trying to see if the form has been posted but this method does not seem to work if(Request::is_g...

0 Likes
1 Replies

How to compare json array in Laravel 4

There is one problem which I can't solve. I need to show a response only for users whose user_id was...

0 Likes
0 Replies
posted 10 years ago

Using a preloader to return data

I'm using CURL to process data that is sent to an API cross site. When I get the data back to displa...

0 Likes
0 Replies

Using AJAX or CURL?

I am using the expedia API and I can send request using CURL. Using Laravel 5, am I better to stick...

0 Likes
0 Replies

Non autoincrement id for a model returning 0 on id when created

I have in my model several tables where the primary key it's not autoincremental, but it's a varchar...

0 Likes
1 Replies
Solved

Best practices for responsive view?

#Background My Controller is loading several items (from an Eloquent Model) and passing them into th...

0 Likes
0 Replies

Using carbon to get next weeks dates.

I have a web page that lists events, it is split into 2 categories: This week (today is FRIDAY so t...

0 Likes
3 Replies
posted 10 years ago

Summing pivot data

I have a model with a belongsToMany relationship with an additional pivot column. public functio...

0 Likes
0 Replies

Thanks to our community

Solutions given in the past year. Excluding solutions from thread authors.

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.