Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
50 views

I have a belongs to many relation between two tables via a pivot table. But the business dictates that the relation needs an additional WHERE clause connecting the first with the last table. table_a ...
Lucas's user avatar
  • 715
0 votes
0 answers
50 views

Am working with laravel 11 with filamentphp 3 on postgres db, I have a schema for Authors, Profiles, Posts and post_has_author. author(author_id, profile_fk,...) profile(profile_id,...) post(post_id,.....
auwalup's user avatar
  • 93
-1 votes
1 answer
48 views

I`m using postgres 17.2 I have transactions table with morph columns entity_type and entity_id. When i use whereHasMorph i got a type error with entity_id because users table id is bigint Example: $...
EyeVers's user avatar
4 votes
3 answers
160 views

I'm trying to use Polymorphic Relationships from this docs https://laravel.com/docs/12.x/eloquent-relationships#polymorphic-relationships I have model Balance class Balance { public $subject; ...
Levsha's user avatar
  • 546
-1 votes
1 answer
67 views

I have a model salesperson, it has model traffic related. I am trying to return all the salespeople with traffic in a given month and get ONLY the traffic from that month. Right now it is returning ...
Chris Lamb's user avatar
2 votes
1 answer
45 views

In my Laravel project. I have model named Section. Each section has a hasMany relation to the Student model with the function studentsInCurrentSession and each student has a hasMany relation to the ...
Faizan Ahanger's user avatar
1 vote
1 answer
35 views

I have the following models/tables: branch: id - integer department: id - integer teacher: id - integer branch_department_id - integer branch_department: id - integer ...
MOHAMMAD RASIM's user avatar
0 votes
1 answer
74 views

I have created a migration name savables as follows, the goal is to attach, and detach the post_id or video_id along with its model type. Schema::create('savables', function (Blueprint $table) { $...
Sadan Khan's user avatar
0 votes
2 answers
65 views

Here is my current setup: <?php namespace App\Models; use Exception; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\...
xmarks's user avatar
  • 1
1 vote
1 answer
45 views

I am trying to apply a different set of date filter depending on the values of the start_date and end_date column of the robot table Condition If robot start date && robot end date are both ...
Yeo Bryan's user avatar
  • 439
0 votes
0 answers
43 views

I'm working with Laravel Eloquent and attempting to load related data using with() alongside a left join, but I'm running into issues. Specifically, I have a Company model with a morphOne relationship ...
csandreas1's user avatar
  • 2,420
-1 votes
1 answer
239 views

I find this error on local development machine. I can see the details of this in the database but when i try to list all the jobs it breaks. So I think it is a something in a way database objects are ...
Mislav Novalić's user avatar
0 votes
1 answer
61 views

I would like to get back within a with() the last entry of a modal which is not null on a certain column. I know that it is possible to simply get the last entry with the following function in the ...
Matthias's user avatar
0 votes
1 answer
25 views

I created a search feature in the disposition table. The initial display is in accordance with the eloquent that I set. but when I change the value of search , the where clause that I set cannot work ...
Putra Edi Sujito's user avatar
3 votes
2 answers
70 views

I am developing a database for giveaways. I have two main tables: participants and giveaways with an N:N relationship since a participant can participate to one or more giveaways and a giveaway can ...
nglx's user avatar
  • 321
-3 votes
3 answers
190 views

I've got a requirement for a set of models with the same database table, but they need to implement certain methods in a different way. Given a set of classes like this: class Item { protected $...
miken32's user avatar
  • 42.5k
0 votes
1 answer
91 views

How do I get the data from a relationship table? this is the tables' structure: paradises id - integer title - string travel_interest_id - integer travel_interests id - integer ...
dapidmini's user avatar
  • 1,643
1 vote
1 answer
174 views

I'm working with Filamentphp, and I've created a "Report" resource. When creating a Report I want to automatically fill in data from the logged in user to the form. Forms\Components\...
Coder Dev's user avatar
0 votes
1 answer
59 views

Laravel eloquent uses subqueries for relationship model instead of joins as joins offer more optimal performance .How does eloquent orm ensures performance for relational models ?
Rubin Porwal's user avatar
  • 3,845
3 votes
0 answers
1k views

I have a json column in my database table which stores the foreign keys, the field name is cast as array on the model. I am using multiple select with a relationship and the record get saved as ...
Frederick Osei's user avatar
0 votes
1 answer
194 views

I need to set up conditional belongsTo relationships. Specifically, I have ModelA that can belong to either ModelB or ModelC based on a column value (related_id). For example, if related_id is 1, it ...
Jakub Stępień's user avatar
-1 votes
1 answer
61 views

Here is what the table might look like Store id modelable_id modelable_type name other columns Shoe id sole_id (FK) other columns Cloth id jean_id (FK) other columns Bag id cover_id (FK) other ...
Sunny's user avatar
  • 169
0 votes
1 answer
51 views

So this is the query I have constructed so far $data['requested_units'] = RequestedUnit::with([ 'user', 'agent_warrants' => function ($q) { $q->where('type', RequestedUnit::...
Arsalan Khan's user avatar
1 vote
1 answer
102 views

I have two tables that are connected with a pivot table. shows: +----+--------+ | id | show | +----+--------+ | 1 | show1 | | 2 | show2 | | 3 | show3 | +----+--------+ draft_types: +----+-----...
pbrune's user avatar
  • 500
0 votes
2 answers
52 views

I have an eloquent query: $cameras=Jump::Video() ->with('flight','flight.aircraft','flight.airfield') ->with('student','student.logininfo','student.logininfo....
Sebastian Dratwa's user avatar

1
2 3 4 5
21