Multi Parameter in Search 'GET'

i try to make multi search parameter, i check if request->any have value or not, if have value shot match that value , if not should not append it in search...
princeoo7 princeoo7
7

how to search result in data appended in model ?

I have 2 tabled, First is category and second is categoryTrasnlation. As the name suggest. 1st table save based data for a category a...
ChrisF79 ChrisF79
5

How to save to a database with multiple tables?

I have a Users table and an Address (mailing address) table and I have the relationships set up as such: User Model class User extend...
Formatink Formatink
5

Nested comments with eager loading

Hello, I am currently doing a nested comments system. In my model, I use this method to retrieve children of the comment pu...
mallaury mallaury
6

Get withCount() of nested relationship

Hello, Here is my problem: In my database I have departments that have lessons. Lesson belongs to many departments. So there is a pivot table named department_lesson...
tduffy tduffy
5

Trying to do a SQLSRV Query using cte_sum in Eloquent

I have a Laravel 6 app that uses a MySQL connection for authentication and storing user settings, but it also uses a SQL Server connection to read data for dashboarding. I...
datarecall datarecall
4

Pagination

I have a method on my Supplier model that looks like: public function getAllDiariesAttribute() { $products = $this->products(); $weeks...
t0berius t0berius
2

laravel load() with paginate()

Using the following query: $product->load(['stockItems' => function ($query) { $query->available()->oldest()->paginate(2); }])...
Mikegk Mikegk
8

Relationship Problem

Hi guys, I just faced a relationship problem. I have got a "Category" Model that has many CategoryData (entries). One CategoryData belongs to the Ca...
joseff joseff
1

Please help me with the table structure.

WHAT AM I TRYING TO DO application manager, calendar, custom content template application, facebook application (bring the last post) etc. briefly application manage...
mrcorex mrcorex
5

illuminate/database (+ migrations) outside Laravel

Hey guys. I am trying to find a good solution to use illuminate/database (+ migrations) outside Laravel. I have the need of several packages (non-public) that are ta...
ChrisF79 ChrisF79
2

Unknown Column when inserting into a polymorphic schema

I created a "telephonenumbers" table that will store many numbers for each "customer". However, when I try to insert I get an error that the column &quo...
Dhruva Dhruva
3

How to use Scope for Intermediatble Table in Many to Many Relationships

Hi All I am trying to use scope for retrieving column field name from many to many relationship's intermediate table. Pivot Table fields are quiz...
scottsuhy scottsuhy
3

Eloquent relationships that deal with 3 tables

I have made all the one to many relationships in 3 models ‘user’, ‘auctionschedule’ and ‘auctionregistrations’ for “hasMany” and “belongsTo”. Here is...
Mick79 Mick79
15

Group by month and order by something else?

I'm stuck... I have a series of posts that can be upvoted by my users. I require these posts to be grouped by month (as this is how I display them on the site) but w...
Eloquent
15
273
eeight eeight
8

One To One (Polymorphic) - nullable?

Is it possible to have a One To One Polymorphic relationship nullable? I want to extend the users table (adding userable_type and userable_id) and 2 morping tables (mentors...
jesse_orange_newable jesse_orange_newable
2

Working with date and time

I have a query scope called inDate that is meant to check the given start_datetime and check whether its newer than today i.e Carbon::today(...
graemenewable graemenewable
4

How to prevent the rounding of decimals when inserting into mysql database

I have a strange issue whereby each time I insert or update decimals into my database, the decimal values get rounded. For example if I insert 51.4988814, it g...
timtom timtom
11

Update return false

Hello, I try to do an update request but the request return false. Do you know if something exist to see the error in details (and not just get false in return ...)...
Talinon replied
Solved
Eloquent
11
162

hasOneThrough RelationShip

i have City Model (id,name), and Address Model (id,cities_id,users_id) and Orders Model (id,products_id,addresses_id). in Orders Model i...
TristanKobalt TristanKobalt
10

Using model variables in a relationship function

I am trying to constrain a relationship based on another relationship from that same model. class CinemaRoom extends Model { public function cinema() { r...
Eloquent
10
279
krie9er krie9er
10

how does laravel know?!

Heylo, i've made some startexercieses and they were pretty cool. But i still have one question: how does laravel match a model to the equivalent of the...
Eloquent
10
320
ajfick ajfick
2

Splitting model data between tables based on type

Hello! I'm working on a listing site which will have a few major categories of listings available to users. These categories will each have some "listing type&q...
TomNeal TomNeal
7

Quickly counting records with Eloquent

Hi, I display in my application a count of the records that exist within a table. When the user changes an input i.e. selects a different start date, it sends an aja...
TomNeal replied
Solved
finlamit finlamit
1

Eloquent, group by relationship.

Hi My data. Projects -> (has many) Tasks -> (has many) SubTasks I am looking to display all of the SubTasks in order of the Su...
KevDev KevDev
4

Whats the best way to remove item on a hasMany relation

Hi. So I have a posts that has a hasMany relation with photos and then I remove 1 of the photos but the relation only no...
FrankClark FrankClark
2

Eloquent : Scope whereIn matches all (relation)

Hello There, I have a table rooms And a table room_availabilities A room has many room room_availabilities...

send static data with eloquent result

from cookies, I get (item_id, item_qty), depend on item_id I make a select statement to return data, I want to send item_qty with this statement to the blade...
Drummerkolle Drummerkolle
3

Eloquent Has many over different models with index sort

Hi everybody, I'm kind of stuck what to do for my use case, or better which relation to choose for it... I want to have a table for multiple webpages (landing...

query inside foreach

i try to get all product where id in array if(isset($_COOKIE["shopping_cart_panorama"])){ $cookie_data = stripslashes($_COOKIE["shopping_c...
Mrs_Beginner Mrs_Beginner
5

some thing like Soft delete in model for returning only active models

i Have product model (Belongs to products table), and i want to tell model when i select any product you have to return the models that their Active column is True,...
derekdunes derekdunes
1

Laravel 7 sync issue using eloquent models

Please how do you perform this code $user->roles()->sync([1 => ['years' => true,'levels' => true], 2, 3]); using a for loop or for each...
yaeykay yaeykay
1

Laravel whereDoesntHave union whereHas

I'm trying to query my models that don't have relation and union it with the ones that have relations but I get an error with memory being exhausted. Post::w...
schroedingerswg schroedingerswg
2

Getting error on one-to-many relation

Hey, I receive this error, when trying to get the relation: https://flareapp.io/share...
oroalej oroalej
4

When to use Model Observers and Mutators

Hi All, When do I need to use Observer and Mutators? For example I have 6 Setters and Getters, is it better to just place it in Observer's creating...
Create a New Discussion Button