Support the ongoing development of Laravel.io →

4,290 Threads

[Eloquent] attach() to a pivot table when clicking on a butt

As part of a Laravel project, I plan to create a site that allows users to add video games to their...

0 Likes 2 Replies

How to create a collection referencing multiple relations th

I have an issue that I'm running into and can't seem to find an answer or figure it out myself. So h...

0 Likes 1 Replies
Solved

Laravel 6 pivot casting

try to use following in Laravel 6 but the 'relations_type' column in 'contactable' table does not re...

0 Likes 0 Replies

I need help to fetch the sum of adult_rates from a colum

DB::table("rates") ->selectRaw("sum (datediff( day, case when $start_date > sta...

0 Likes 0 Replies

use eloquent model in lumen scheduler

I using eloquent model in lumen scheduler but show error Call to a member function connection() on n...

1 Likes 0 Replies

Fake model relationship

I have a project model where I want to associate roles and then users. The roles is a subset of the...

0 Likes 0 Replies

Custom cast ignored after updating model

After I update my model, the cast is ignored and an old value that comes from classCastCache is show...

0 Likes 0 Replies

laravel-automatic-migrations: Automatic migrations

https://github.com/bastinald/laravel-automatic-migrations Laravel Automatic Migrations Automatic mig...

0 Likes 0 Replies

Is there a sexyer way to write this code? (Laravel/Scout)

Hi everyone, name is Lucas, first post here and I'm learning Laravel and loving it. I'm working in a...

1 Likes 1 Replies

eloquent eager loading to limit for each post

I saw this thread from 7 years ago and thought I should update the answer. To improve on viquanghoa...

0 Likes 0 Replies

Querying Polymorphic Relationship in Global Scope

I have a 'projects' table that has a polymorphic relationship with a 'departments' table that allows...

0 Likes 1 Replies

Why Laravel model observer doesn't work??

<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminat...

0 Likes 1 Replies

Eloquent Relationship

i'm trying to get an authenticated user document shares with their relation in laravel $totalDocShar...

0 Likes 1 Replies

How can I merge two eloquent queries in laravel?

I am making laravel project. There is need to merge two complex eloquent queries, not query result....

0 Likes 1 Replies

Does not laravel eloquent have query like WhereNotHas?

I want to distinguish 2 queries when one field is null or not null. Let me see one table named 'repo...

0 Likes 0 Replies

Laravel query with subqueries and foreach

I wanna to show common users verified, not out of date and unbanned: a) all songs b) songs by title...

0 Likes 1 Replies

Help converting SQL to Eloquent

I'm trying to convert an SQL Query to a relationship in Eloquent, and having great difficulty. This...

0 Likes 0 Replies

Problem to store data <input type="hidden" ......

This works when entering data to database in the form: <tr> <td>{{_('Longitude')}}&...

0 Likes 0 Replies

unable to fetch data from profile class using user class.

=> Illuminate\Database\Eloquent\Collection {#4087...

0 Likes 2 Replies
Solved

SASS app where to save each users data?

Hi all, I’ve recently been playing around with Larvel and building a sample project to try and wrap...

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.

© 2023 Laravel.io - All rights reserved.