Support the ongoing development of Laravel.io →

4,311 Threads

One-To-Many Relationship On The Same Model [Laravel 5]

I'm having a bit of trouble making this work properly when querying with Eloquent, here's the model...

0 Likes
5 Replies
posted 10 years ago

How could I create custom Model Events?

Is possible to create custom model events as creating, created, updating, update, ...? Thanks in adv...

0 Likes
13 Replies
Solved

Unable to use Foreach loop with results of DB::Table

I'm unable to wrap my head around why I'm getting "Cannot use object of type stdClass as array&...

0 Likes
2 Replies
Solved

creating like and dislike buttons using polymorphic relation

hi, i want to create a like and dislike buttons on a post, which save the status of the user in a li...

0 Likes
0 Replies
posted 10 years ago

Iterate through model attributes

Some of the columns in my tables have data that has been serialized. I can easily fetch a row and it...

0 Likes
3 Replies

How use eager loads for pivot table?

Hellow all! Is the table structure: doctors id - integer title - string clinics id - in...

0 Likes
2 Replies

Allowing users create tables on the fly

I am building an new application using Laravel and i want the user/owner to be able to create regist...

0 Likes
1 Replies

Trying to get property of non-object

Hi! I try to solve my error, but I don't find solution. I try to get all exercises in my table exerc...

0 Likes
1 Replies

Adding Data to database using Eloquent Model

Im new to laravel and i wish to add some data to my database, im following tutorial from lynda.com U...

0 Likes
3 Replies
posted 10 years ago

One-to-one relation through pivot table

I have component A, users, which connect to component B, addresses. One user has one address, always...

0 Likes
12 Replies
Solved

How to check if a Foreign Key exists

In my migration code I have: if (Schema::hasTable('activity_log')) { Schema::table('activity...

0 Likes
8 Replies
Solved

Is it possible to sort results by relation without a join?

Currently I am retrieving product results for a category like this: $products = $category->produc...

0 Likes
0 Replies
posted 9 years ago

Eloquent hasMany with multiple foreign keys and where

Hi! I have two tables, tasks id startTarget endTarget status targets id title I need get all tar...

0 Likes
2 Replies
posted 6 years ago

filter data in hasMany using where and parent field value

Hi, Is it possible to filter the data returned by relationship using values in the parent class Prog...

0 Likes
0 Replies

DB query builder with LEFT JOIN using a RAW expression

I would like to left join data from a many-to-many relationship. In my first attempt to solve the pr...

shikhar-kr liked this thread

1 Likes
0 Replies
posted 9 years ago

Handling unchecked checkbox by updating

When a checkbox is not checked, it gives no value back. How to handle this in your model when updati...

0 Likes
8 Replies

remove null from laravel collection ,php array

Hello I need to remove null coming from database , after using this code $school_dropdowns = DB::tab...

0 Likes
1 Replies

Searching for newest data and oldest data from the DB.

How do i use Eloquent to search for newest and oldest records from the database.

0 Likes
4 Replies
posted 6 years ago

How do I integrate a custom sql into a model

Hi, I am using Eloquent with Codeigniter, and I have a model that has multiple one to many and many...

0 Likes
1 Replies

DB::select with raw where

Hey, I'm having a hard time compiling the DB:: or preferably Eloquent code for a query that involves...

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