Support the ongoing development of Laravel.io →

4,311 Threads

Multiple conditional joins

So i tried using multiple conditionals on my join but laravel assumes that on join i will be compari...

0 Likes
1 Replies
posted 10 years ago

How to set model of hasOne child relation in code.

I have a model: class Parent extends Eloquent { public function child() { return $this->has...

0 Likes
3 Replies

What is the prefered way to retrieve related models?

Which one of these two calls is the prefered way to retrieve guests checked-in at a hotel? $guests =...

0 Likes
2 Replies
Solved

How to get page number before pagination query?

Hi all, I get posts with the query below in pagination: $posts = Post::all->paginate(30); I want...

0 Likes
1 Replies

How to pull a database into a HTML table?

Hi Guys, I'm quite new to laravel and I'm trying to work out how to turn a database table into a HTM...

0 Likes
2 Replies

4.3 models in app directory ?

Why is this good idea? As i see it gets quickly pretty rough when you have 100+ models to work with....

0 Likes
4 Replies

Eloquent relationship with count

I have three models: User: public function projects() { return $this->hasMany('StoredFile', '...

0 Likes
6 Replies
Solved

Class Referencing

I am new to PHP and Laravel and this is my first project. I am writing a package that will allow a u...

0 Likes
2 Replies
posted 10 years ago

Can I use a item of a model several times

Hello, Im working on a financial app. Now I have this model : description : string ; account_from :...

0 Likes
0 Replies
posted 10 years ago

many-to-many relation between pivot tables. Is this possible?

Consider the following: student many-to-many with semester (pivot1) lesson many-to-many with cla...

0 Likes
0 Replies

"Order by" when querying relation

Hi, I have a Project table and a pivot table "like_project" which has 2 columns : user_id...

0 Likes
1 Replies

Mutators problem

I have Email model with: public function getEmailJsonAttribute($value) { return $value ? json_de...

0 Likes
1 Replies
Solved

Get a birthday

I want to be able to take in 3 inputs. A select for a month, a day, and a year. Then, when the form...

0 Likes
0 Replies

Get a birthday

I want to be able to take in 3 inputs. A select for a month, a day, and a year. Then, when the form...

0 Likes
0 Replies

Relationships, Eager Loading and Pagination

I have 3 tables: Topic: id Sub-Topic: id, topic_id Resources: id, subtopic_id Topic has 'hasMany' re...

0 Likes
0 Replies

withTrashed() failed after upadting to 4.2

After updating to 4.2 using composer update, I have added use SoftDeletingTrait; protected $dates =...

0 Likes
3 Replies
Solved

Pagination and Eager Loading

My Controller method is: $topics=Topic::with(array('subtopics'=>function($query){ $query->with...

0 Likes
0 Replies

Retrieving primary key after row insertion

I have three tables - users, spots, and tags When a user creates a spot (location), they also create...

0 Likes
2 Replies
Solved

Convert fluent query to Eloquent

Hello I have this query: $galery = DB::table("galery") ->where("approved"...

0 Likes
0 Replies

Take all user post comments

How can I take all user post comments? I'm already using morphTo() method between comments and posts...

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

© 2024 Laravel.io - All rights reserved.