Support the ongoing development of Laravel.io →

4,606 Threads

Eloquent vs. Raw SQL? Which is really better?

Hello guys, I know this question sounds kind of silly, but let me explain. I (mostly frontend-dev) a...

0 Likes
4 Replies

Random code execution stops when using Eloquent chunk()

I have a method for a scheduled system cleanup that goes through all the files in the "storage&...

0 Likes
1 Replies

Query builder returns a Collection when empty and an array when it's not

How can I validate it? If I use: $res = DB::table('estacaohs') ->whereRaw($sql) -...

0 Likes
1 Replies

Curious about scaling (server management)

lately, I deeply read article related about "web scale" topic, there are several very nice...

0 Likes
0 Replies

sen mail after insertGetId

Hello This is my first time I use laravel, i´m trying to manage to insertGetId and send mail to spec...

0 Likes
0 Replies

Result of query into view with foreach

hi all, i have this query: $marche = DB::table('articolo') ->join('marca', 'articolo.id_marca',...

0 Likes
1 Replies

Count the unique (in terms of two columns) records

Hello, community. Can anybody help me with the count query? I have the pivot table with two fields →...

0 Likes
0 Replies

mutator $this->attributes return 'Undefined index: id'

I'm trying to add an attribute to a model but can't access the model attributes when I call it. Deta...

0 Likes
1 Replies

2012-07-09T19:22:09.1440844Z to Timestamp

I saw this format of datetime on a Json file recently. Having issues to convert this into a timestam...

0 Likes
1 Replies

Eager load, get all results

Hi guys. I have model 'Element'. Each element have some params (Param model). So there is relationsh...

0 Likes
0 Replies

SQL Query navigating 3 tables in Eloquent

HI, I am new to Laravel and was hoping someone could help. I have 3 tables, SupplierPO, Orders and C...

0 Likes
3 Replies
Solved

Retrieving Models with Name in a Variable. ex $class::all() - is there a way to do it?

I have some code as follows: if($modconfig['needs_models']) { $models = explode(",",$...

0 Likes
1 Replies
Solved

how many relationships should a model have

HI , Ive got a question , Im rebuilding a application I built for a client about 6 years ago . At th...

0 Likes
10 Replies
Solved

Lumen gets wrong value from .env

I've created a Lumen project and copied .env.example to .env. After that I changed DB_DATABASE, DB_U...

0 Likes
2 Replies
Solved
posted 9 years ago

How to make an select and multiple join in one sentence

Hi to all, i'm new in laravel :) and i have a doubt. I need, like the title says, do the both consul...

0 Likes
2 Replies

Laravel 5.1 Eloquent multiple pivot tables or threeway pivot?

I am struggling. What I try to do is to create a message system where users can send messages to eac...

0 Likes
0 Replies

Error when running: php artisan migrate:refresh

This is the error that I receive when running the command: php artisan migrate:refresh {"error&...

0 Likes
4 Replies

Passing variables from one seed file to another?

I have created multiple seed files and my main DatabaseSeeder file looks like this: <?php use Il...

0 Likes
0 Replies

Most Used Tags

hi! I have a Post and Tag model with a many to many pivot table, how do you write a query to find th...

0 Likes
0 Replies
posted 9 years ago

Laravel Elequent Relationships

Hi, I have created a migration file, one of the things I do is this Schema::create('project_document...

0 Likes
1 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.