Support the ongoing development of Laravel.io →

4,312 Threads

posted 7 years ago

withDefault for hasOne?

Does withDefault() work with a hasOne relationship? I haven't been able to get it to work.

0 Likes
0 Replies
posted 10 years ago

Once again: Difference between hasOne / has Many and belongsTo/belongsToMany

Hi! I know, thist question has been discussed already in this forum. But sorry, i just don't get it....

0 Likes
5 Replies
posted 7 years ago

Eloquent object save() updates multiple records

Hello, I'm fetching a specific record with a DB table using MyTable::where(['type' => $sometype])...

0 Likes
4 Replies
posted 7 years ago

eloquent relation definition with condition

Hello, I have a relation like this : A - id - fields - X B - same id as A - fields C - same id as...

0 Likes
1 Replies

Distinct returns wrong count in Laravel 5.4

I am using Laravel 5.4 and MYSQL I have a table 'products' and a related attribute table 'products_a...

0 Likes
2 Replies

Check the status of a record in the Database and return a value

Hello everyone, I'm starting with Laravel and I'm really enjoying it. I need your help, I need to qu...

0 Likes
1 Replies
posted 7 years ago

filter query by method

Let's say that I want to retrive from database the list of artists that have recorded exactly 100 so...

0 Likes
6 Replies

Eloquent and Unions

Hi, I'm using Laravel 5.1 It is possible to construct this query with eloquent ORM? SELECT SUM(CASE...

0 Likes
1 Replies

retrieving data for editing using a dynamic dropdown

I successfully created a two-level dynamic dropdown using buildings and rooms by following Hardik Sa...

0 Likes
1 Replies
posted 7 years ago

Eager Loading query executions

Hi all, According to laravel docs when we use $books = App\Book::with('author')->get(); foreach...

0 Likes
0 Replies

Eloquent Query pivot data

Hi, I am having problem with my query. I have 4 tables users,prospects,leads,items. All of them rela...

0 Likes
0 Replies

Define a relationship as a union

Hi, I would like to know if there is a way to define a relationship as a union of two tables? I've a...

0 Likes
1 Replies

Laravel 5.4 Database Placement Questions

I know how I can get the data needed, but want to follow Laravel/MVC practices here and new to it. I...

0 Likes
1 Replies
posted 7 years ago

How would you go to create a relationship between 3 tables having a forth pivot table. Laravel 5.4

How would you go to create a relationship between the following tables: Users table: Schema::cre...

0 Likes
1 Replies

what should contain in pivot table

I'm trying to use pivot table. But I'm confused how should I define my database tables. Concept: Pac...

0 Likes
1 Replies
Solved

[L 5.4] how to forbid multiple responses

Hey guys! In my applicatio, every logged in user can open a "feedback-site". That site has...

0 Likes
1 Replies

How to use laravel application as both web application and Rest API

I am implementing a laravel web application and I separately implementing native mobile application...

0 Likes
4 Replies

Updating a model doesn't work when specifying a morphMany relationship in the withCounts attribute

Has anyone ever run into an issue where you can create records just fine, but the moment you want to...

0 Likes
0 Replies

opposite eloquent method to grabbing related data

I am looking for the opposite of getting all Data that is related in a many to many relations, thus...

0 Likes
5 Replies
Solved

Laravel Eloquent using 'with' and 'where'

Laravel 5.4 I am having a hard time using "with" and "where" together. Instead o...

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