Support the ongoing development of Laravel.io →

4,310 Threads

Migrating tables and problems with foreign keys

I have created about 25 database tables in the migrations folder by first creating the files with ph...

0 Likes
2 Replies

Can you use belongsToMany with non-primary-key fields?

I have the following tables users id email teams id teamlist id team_id email The reason there...

0 Likes
2 Replies
posted 10 years ago

Is possible to do this?

I have a User and a Country models, and the user model has one-to-many relation class User extends E...

0 Likes
1 Replies

Having trouble testing model validation.

I'm just starting out with TDD and I'm trying to test validation in a model. Currently, all my test...

0 Likes
1 Replies
posted 10 years ago

Polymorph many-to-many relationship - Model.php fails to find my class.

Hello, I've been having immense problems trying to get the Polymorphic Many-to-Many relationship to...

0 Likes
2 Replies
Solved

Help: Model isn't being mocked properly inside Repository test >_<

Hopefully someone can help me, I've been trying to find out why for the last few hours. I'm trying t...

0 Likes
3 Replies

Weakness of whereRaw: Expression should be enclosed in ( ) automatically

Example resulting in wrong result (is used for a scope-Method): return $query->whereRaw(<<&...

0 Likes
0 Replies

Structure repos for api client

I have a Post model, that read from my table "posts". In my PostController, I inject an Po...

0 Likes
1 Replies

Help how to have a better management of dependency for my controller

Let's say I have a controller named "PositionsController". This controller depends on &quo...

0 Likes
2 Replies
posted 10 years ago

Retrieve model using pivot-table, return the model to client as JSON, and include a column from pivot.

In my code I retrieve a category like this: $category=Category::find($categoryID); And then echo its...

0 Likes
1 Replies

Retrieve a model with selected column(s) only, then update one of those columns?

In one of my controller-functions I retrieve a model: $user=User::where('token',$token)->first();...

0 Likes
1 Replies

Searching many-to-many relationships

Hello folks. I am in need of a little direction on setting up a query on a many-to-many relationsh...

0 Likes
14 Replies
Solved

Best method to apply filter after a read event Model::find(xx)->toArray(); ??

In one of my project, I'd like to output a json value from my mysql table immediately to array when...

0 Likes
0 Replies

Models and realtionships with a pivot table

Sorry for the noob question. I am using what I guess what is referred to a pivot table in Laravel 4...

0 Likes
0 Replies

Queries based in a previous result

Hi guys, I'm fairly new to Laravel, I'm designing an application which will have an API which return...

0 Likes
2 Replies
Solved

Query builder with complicated inner selects and joins

I have been trying to get this query working using Query Builder. Still haven't been able to get a w...

0 Likes
2 Replies

Returning results from repositories - best practices.

I've been exploring the use of the repository pattern in a new project by using interfaces and eloqu...

0 Likes
0 Replies

DB versus Eloquent execution time comparison

I've inherited an application that I'm supposed to "fix" from prior development and I noti...

0 Likes
0 Replies

Something wrong with this Elloquent Query... Help

Hi, I'm trying to run the following query but it's not returning anything ... any idea why? $comment...

0 Likes
7 Replies
Solved

eageer loaded->eager loaded model not in the object.

Hello everyone, In my database I have two tables: Users and Notes An User has many notes and every n...

0 Likes
4 Replies
Solved

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.

© 2024 Laravel.io - All rights reserved.