Relative Content

Tag Archive for strapi

CORS in strapi v4.24.2 doesn’t work anymore

i’m trying to add CORS for some of my sub-domains/domains such that only those will be able to access my strapi resources but unfortunately i’m unable to do so. I followed the documentation as per https://docs.strapi.io/dev-docs/configurations/middlewares, still no luck, I can still access strapi backend through any domain (currently testing with http://localhost:3000/ – my nextjs project (strapi running on http://localhost:1337)). I tried adding @koa/cors and added in resolutions as well but still no luck. Below are some details about the project and some related code ;-

STRAPI CMS: OneToOne Relation Problem from one Collection

so i have the following problem at my strapi project:
I have a Collection called Player (Many Names) and a Component called Substitution.
Inside the Component i want to just select 2 Players from the Players Collection in 2 seperated fields. (PlayerOut, PlayerIn). So i’d say its a normal substitution case, but Strapi can’t handle that i put 2 relations on one Collection.

How to get Strapi relantionship fields in lifecycle methods

In my Inventory model, I have two relationships, one for supplier and one for the product. They are both 1 to many with Inventory. My question is how can I get these relationships from the event object that strapi generates in afterCreate or afterUpdate method. For example, here’s my code where I want to retrieve supplier and product info from the event object, unfortunately the event object doesn’t seem to have relationship fields, I only get these values: