#### Category : pivot

I want to seed an additional column in a pivot table. Ideally, I want it as a date so I can change the format, but for now, I’m manually typing days. My pivot table is shift_user, and I have added an additional column called day. It looks like this… for the seeding part, I’m using ..

I have model IgAccount, which hasMany model IgPost Then I have model IgHashtag which is connected via pivot table to IgPost My pivot table is ig_hashtag_ig_post Now, i want to get all IgHashtag whereHas IgPost which belongsTo user’s IgAccount and I want to also load this with last 4 IgPost, for each IgHashtag I have ..

I have a pivot table in my database that combines users and loans. The table is the following. user_id loan_id amount Now I have the following code to insert data into the database $user = User::find(2);$user->loans()->create([ // Some database insertion ]); $user->loans()->attach(2, [‘amount’ => ‘500’]); And I am getting this error… IlluminateDatabaseQueryException: SQLSTATE[HY000]: General .. Read more So I have models: Customer SubscriptionPackage What I want is to make a relationship between them with pivot table customer_subscription_package. So when I get a customer instance, i can get his subscription_package_name that is in the subscription_package table and also to get the start_date, end_date … from the pivot table. The thing in my case .. Read more I’m using Laravel 8.0 I have two tables, Module and User, linked by a pivot table (module_user), I’m trying to work out how to list ALL of the modules using eloquent (or SQL) and if the current user has a pivot entry (e.g. they have completed the module) then it marks that, for example: Module .. Read more I have a table that is linked to multiple other tables in a many-to-many fashion. In my example, pmds (primary medical doctors) are records in the users table that have a role_id that corresponds with pmd in the roles table; AND are associated with the sites table through the intermediate table site_user; OR are associated .. Read more I have two tables developer table and skill table which are linked with many to many relationship developer_skill table. I want to store developer_id and skill_id is in pivot table. but when developer add their skills and submit it return error. on developer table data add but in pivot table data not added. error SQLSTATE[23000]: .. Read more IlluminateDatabaseQueryException with message ‘SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘db_testmasjid.jamaah_model_kajian_model’ doesn’t exist (SQL: select kajian.*, jamaah_model_kajian_model.jamaah_model_id as pivot_jamaah_model_id, jamaah_model_kajian_model.kajian_model_id as pivot_kajian_model_id from kajian inner join jamaah_model_kajian_model on kajian.id = jamaah_model_kajian_model.kajian_model_id where jamaah_model_kajian_model.jamaah_model_id = 4)’ Sourc.. Read more i have a pivot table that i want to record some data along with user on form submit. but im getting an error illegal offset type.$user has a value. same value if i add manually it works. my controller public function store(User $user) { //dd(Request()->all());$data = request()->validate([ ‘title’ => ‘required’, ‘link’ => ‘required’, ..

Trying this for hours now and I don’t see the error. I have a model ‘User’ and a model ‘Round’. I want to define a n:m-relation with a model ‘Flight’ as pivot model. User.php <?php namespace AppModels; use IlluminateContractsAuthMustVerifyEmail; use IlluminateFoundationAuthUser as Authenticatable; use IlluminateNotificationsNotifiable; use SpatieMediaLibraryHasMedia; use SpatieMediaLibraryInteractsWithMedia; use SpatieImageManipulations; use SpatieMediaLibraryMediaCollectionsModelsMedia; class User ..

Trying this for hours now and I don’t see the error. I have a model ‘User’ and a model ‘Round’. I want to define a n:m-relation with a model ‘Flight’ as pivot model. User.php <?php namespace AppModels; use IlluminateContractsAuthMustVerifyEmail; use IlluminateFoundationAuthUser as Authenticatable; use IlluminateNotificationsNotifiable; use SpatieMediaLibraryHasMedia; use SpatieMediaLibraryInteractsWithMedia; use SpatieImageManipulations; use SpatieMediaLibraryMediaCollectionsModelsMedia; class User ..

I am new to laravel and trying the following: I have these tables: disciplines: id | name specialties: id | name categories: id | name discipline_specialty (pivot table): id | discipline_id | specialties_id Discipline model: public function specialties() { return $this->belongsToMany(Specialty::class); } Specialty model: public function disciplines() { return$this->belongsToMany(Discipline::class); } My question is: how ..

I faced an issue where I’m unable to retrieve data through the pivot table, In my application there’s a separate table to store the files data and a separate table to store the competition and a separate table to store the teams. And there’s a table named competition_file which has the competition_id, team_id, file_id. a ..

I have an extra column for usernames in my role_user pivot table, how can I sync the username with the roles ? role_user pivot table I need to sync the user name in the name field This is the update function where I have added the sync public function update(Request $request, User$user) { $role .. Read more In my project there’s a competition which includes many teams and an organizer can upload many documents/photos to a competition assigning to a team, so I decided to make a files table to store all the file data while there are separate tables for compactions and teams and I made a pivot table as competition_file .. Read more My project is credit analysis and sometimes a user will need a guarantor, which is also a user and a guarantor can be a guarantor more than once: Like: Tony is a user Jacke is his guarantor Maria is a user Jackie is also her guarantor It is a case of having a pivot table .. Read more I am trying to store a "project" with its respective categories. the categories are already defined in the category table. in category_project pivot table I have category_id and project_id. I have been able to get the category_id, but not the Project_id – When I submit the create form Laravel throws me an error saying that .. Read more I got 3 tables. Table 1 & 2 has their ids as foreign keys in third one(pivot). Relations for first one is$this->hasMany("AppPivot","game_id"); , second is $this->belongsToMany("AppPivot","army_id"); and pivot has relationships with both of them i.e belongsTo. My schema: I tried accessing it in controller of first one like this:$games= Game::with("armies")->get(); Result that i ..

I would like to use a ‘userables’ table to store user relationship to various other models, such as ‘Projects’ and ‘Actions’. The user relationship also has an attribute, such as "Owner" or "Contributor". I’m having trouble syncing (and/or attaching and detaching) the relationships with this additional attribute, despite trying various similar posts and scrutinising the ..

I have a many-to-many relationship with a pivot table. The two models in the relationship are Communities and Personas. In the pivot table, I have the IDs of the instances in relationship and an extra field called "member_count" to count the amount of members in that specific relationship. To access the member count field, I ..

I have been stuck on this since May 2020. I don’t know how to move forward with the project. Any link or guidance would be very much appreciated. I’m trying to create a very simple rental system. I have a Customer table: id, Name, Barcode Another one is Item table: id, Name, Barcode, OnLoan I’m ..