Trying to use Same column as primary key in multiple tables, ''invalid field definition of index or relationship fix" error appears - ms-access-2013

I am new to MS Access. I have created 5 tables and this is my relationship view:
relationship
But when I am trying to establish a relationship between tblCard.CardID and tblFacilities.CardID, I get an error
invalid field definition of index or relationship fix
All the CardID columns are autonumber.
Can anyone please tell me why this problem is appearing?
Thanks in advance
I checked the indexing of all the CardID columns. I don't understand why this is happening.

Related

Backpack Laravel select2_from_ajax field returns results, but I can't select any

I'm implementing a 'select2_from_ajax' field using Backpack for Laravel.
I've implemented this in other places and it works correctly. But for some reason when implementing it this time it will not let me select any of the options and doesn't show the highlight when mousing over the options. It lists out the options correctly, I just can't select any of them.
The only thing I can think of is that the relationship it's trying to reference doesn't have a primary 'id' field in the database, but I'm not sure why that would affect this.
I have implemented both the index and show routes.
The issue was that the relationship field's primary key was not 'id' it was setup with a different column name.
I reworked the data structure so the foreign key referenced was pointing to a column labeled 'id'.

Laravel 6 database error : Integrity constraint violation

I am trying to set up the relations between my migrations in Laralvel 6, but I still have this error message and I do not understand why ....
When I want to publish an article, it takes the query but returns empty tables.
From the very limited information given, just by looking at the query it seems to be an issue with the user_id. In the insert stament there is no user_id inserted, which might be the problem? In your Article model, is user_id fillable?
If user_id isn't required, has it been made nullable in the migration for articles?
Please provide some examples of the migration, model and the method in the controller used for the create of the Article.

How to add in a model collection an associated row of related a model in laravel

I don't know if my title is right so feel free to edit this post and remove this first paragraph of my post.
I am trying to create a simple API in Laravel and I'm having a problem when i get a paginated shoutouts records to include the users who create it. I have 1 is to 1 relationship between User and Shoutout model and in the tables the shoutouts have the foreign key of user_id since the user is who created the shoutout and not the shoutout created the user.
So I tried to get a collection of shoutouts and include the user associated with it with this method:
$shoutouts = Shoutout::with('user')->paginate(15);
but I Having this error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users.shoutout_id' in 'where clause' (SQL: select * from `users` where `users`.`shoutout_id` in (1))
and it looks like the query trying to find shoutout_id to users table and since the foreign key is in the shoutouts table it gets an error in query. If I use this method:
$user = User::with('shoutout')->paginate(15);
there is no problem in querying, but the problem is its now a collection of users not a collection of shoutouts and the shoutout is nested in it, not the user is nested in shoutout collection. Is there a method(function) to use to get what i wanted to happen or a way to do that if if there is no method. I cant find any related question or maybe just my keyword for searching is wrong, feel free to suggest a link here if there is a related question to this question.
edited:
I think i will use query builder instead, but if there is method to achieve this in Eloquent I will upvote for that

Laravel Eloquent : two keys relationship

I have a first table named "Building", and this one gets a Type and a Level. There are multiple building with same type and level.
I have another table named "BuildingInfo", who also gets a Type and a Level. The couple Type/Level is unique on this table.
Is there a way to have a HasOne relationship on Building, giving me the matching BuildingInfo ? The problem being that there are two keys on each table to get it, and I can only specify one key for each table with HasOne().
Thank you.

how adding a fields to relationship Table in pivot table method using laravel

I want to design an online store. For each category of productions, we would have its own fields.
Connections between tables of fields and categories are done and displayed in the part of registration of productions.
At the end, the value of each field should be stored that it should contains the related table between table of fields and productions (in addition to/plus/+) the value of that field.
My problem is in this part and I want that this related table has an additional field that I could value it.
In the following figure, the picture of table and my connections are shown, if there is (any problem/ something wrong with it), I would appreciate you to help me.
View Relationship Images :
http://ir-up.ir/uploads/1416568805731.jpg
You'd simply need to add a withPivot when declaring the relationship:
return $this->belongsToMany('Role')->withPivot('foo', 'bar');
Extra attributes in pivot tables are covered in the docs, here - http://laravel.com/docs/4.2/eloquent#working-with-pivot-tables

Resources