Support the ongoing development of →

4,232 Threads

whereHas for polymorphic relations

Hello, I'm trying to load an Eloquent model with a polymorphic relationship. I want to get Photos th...

0 Likes 0 Replies
7 Feb, 2014 at 04:44

Laravel model metadata

Hello there is this old thread here: Someone...

0 Likes 6 Replies

How to limit records from related tables?

Hi everyone! I'm new to laravel and I need some help with this problem. I have 2 tables posts and po...

0 Likes 4 Replies
6 Feb, 2014 at 09:30

Eager Load with Limit / Take()

Hi guys i'm trying to Load all Collection with Items inside Collection with Eager Load but i only wa...

0 Likes 1 Replies

"Prefix" all queries with a where clause

I'm buidling a SaaS and have added a client_id column to each of my tables. Now in my repositories,...

0 Likes 3 Replies

Eloquent: join on confition

Hi, I need to join one table into a query only if another condition is true. I try, using the exanpl...

0 Likes 4 Replies

Fix for "Undefined property: {ModelName}:$attributes" error

The old forums either had no solution for this, OR said the issue was solved by switching to file ca...

0 Likes 0 Replies

How to clean up this code? Dynamically setting property names, eager loading, handling arrays

WARNING: NASTY PROCEDURAL CODE AHEAD. Let's say I have an ajaxified to-do list app. I have this rout...

0 Likes 0 Replies

[Tutorial] Model Validation using Observers

Hi guys, I have recently posted a new tutorial on something that seems to have been missed by the La...

0 Likes 2 Replies

Ho boy - I have a very large query with > 10 joins - is there a way I can do it with Eloquent?

I've been searching and hacking away for the past few hours now. I have a bunch of models. They're...

0 Likes 0 Replies
6 Feb, 2014 at 02:04

Foreign Keys without schema builder

I've been building most of my database tables without the use of the schema builder. I need to creat...

0 Likes 4 Replies

Is it possible to call directly from a class.

Hi all, I'm still chipping away at learning Laravel. Coming along slowly though. :-/ In my db class...

0 Likes 2 Replies

Eloquent nested eager loading : bug or fail syntax ?

Hi all :), First of all : I opened a help paste here describing the core of the problem. I did many...

0 Likes 0 Replies

Best practices or better way to achieve these relationships

I'm developing an application system. Breakdown is there are Events and Districts - the Application...

0 Likes 0 Replies
5 Feb, 2014 at 04:08

->contains() with morphToMany

Trying to do this, but the "contains" method doesn't work... anyone know why, or how I sho...

0 Likes 1 Replies

select user followed person's post

users id follows id user_id follow_id posts id user_id let say i am user A and i followed user B. I...

0 Likes 0 Replies

How to properly design interchangeable user repository implementation?

I want the repository to be interchangeable, so I'm not dependant on Eloquent. I therefore have an i...

0 Likes 0 Replies

Any easier way to do this? Can you extend a model that's a conditional of the parent model?

Check out my code here: I have a working solution now as shown, but I'd li...

0 Likes 0 Replies

Eloquent relationships remember()

Is it possible to cache relationships with the remember function? $screen->Texts()->with('Tex...

0 Likes 2 Replies

Eloquent mass assignment security policy

The fill method of Illuminate\Database\Eloquent\Model is used for mass assignment, and it is called...

0 Likes 14 Replies

Thanks to our community

Solutions given in the past year.


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

Your logo here?

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

© 2021 - All rights reserved.