my problem was fixed by editing the permission of collection which was related to my field initially it was not set on public role.
Related
I have created a collection (favorite) related to product and user.
My product collection has a field called images but when i make a GET request to favorites i dont get back the images. I have all permissions active for users. This is my query
http://192.168.0.102:1337/api/favorites?populate=product&filters[user][id][$eq]=4.
I am following: https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/filtering-locale-publication.html#filtering
Images are also considered to be 'relations' on a collection. You need explicitly tell it to populate those, see populating two levels: https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/populating-fields.html#relation-media-fields
I have Model name Project and User by using laravel relationship.
- project and user using many to many relationship.
What i want is using laravel authentication giving roles to the user base on project.
Which mean :
user "Ali" have role "admin" in project "project a" ,
but in project "project b" the user "Ali" role is "member".
How can i implement it?
Problem fixed :
My solution is add additional data inside the project_users pivot table store as string role.
When create new project and add with additional data using :
$user->projects()->save($project, ['role' => 'Manager']);
When need to call it :
$user_role = $user->projects()->where('user_id', $user['id'])->first()->pivot->role;
It will return a string 'Manager'
and use it to assign the role.
$user->syncRoles($user_role);
Look at the following links which will help you to achieve it.
https://github.com/spatie/laravel-permission
https://www.itsolutionstuff.com/post/laravel-56-user-roles-and-permissions-acl-using-spatie-tutorialexample.html
You can add the Role data e.g. role_id with a separate Role table or just role in Project To User Pivot Table project_users and retrieve the role info from this relationship.
Check out this Saving Additional Data On A Pivot Table section at Update Many To Many Relationship Laravel Documentation.
The tentative goal is to allow form pre-population from Project entity to related Document entity. Notice that both are custom entities. The relationship between Project and Document is set properly:
And the mappings for this relationship are also set:
However, when we try to create a new Document for an existing Project. The fields are empty:
Why is the pre-population not working?
The out of box workings for mapping only works in the case of creating a record from a grid. If you're not doing this, you won't get the mapping.
How to add a relationship if the field value is 1 using hasmany() doctrine, php
Example
I am having user table and user_locations with multiple locations.
I need to get a record of non deleted locations from the user location table using user Obj.
By default the relation should be added to the records if the locations were not deleted from the user_locations
Note: The location will be deleted by the field is_deleted=1
I updated my database and the I got this message:
Error 3004: Problem in mapping fragments starting at line
927:No mapping specified for properties User.Username in Set User.
An Entity with Key (PK) will not round-trip when:
Entity is type [Db_AcsModel.User]
C:\Users\User\Desktop\MVC\ACS.Domain\AcsModel.edmx
You most likely added a new filed or deleted a filed but the property for the field still exist in your designer and entity class you can manually delete or map the entity variable or you can delete the entity and update your model again.