teleren/devto huggingface dataset:
Has Many Through Relationship Laravel 9 Example
Tags: laravel, php, mysql, codenewbie
Published: 2022-12-27 05:30:00

In this article, we will see that has many through relationship in laravel 9 example. 

hasManyThrough relationship is difficult to understand compared to other relationships. The has-many-through relationship provides a convenient way to access distant relations via an intermediate relation. 

You can use hasManyThrough relationship laravel 6, laravel 7 and laravel 8.

So, let's see laravel 9 has many through relationship, hasmanythrough in laravel 9 example, has many through pivot laravel 9, has many through laravel.

For example, a categories is connected with products, and products are connected with orders, then we can access all orders connected with specific categories. So, simply you can access or get data using intermediate model relation using hasManyThrough in laravel 9.

Now, we will create categories, products, and orders tables. categories table connected with products and products table connected with orders table like the below screenshot and we also create migration and model for all tables and retrieve data using the model.


![Has Many Through Relationship Laravel 9 Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7vwdah5t3ifeovmbq85d.png)
How to use Zustand in Next js , Typescript & React Project
Tags: zustand, nextjs, typescript, react
Published: 2022-12-27 05:13:53

Video: https://youtu.be/d4FafFaaYug
Nexblog Code: https://github.com/0xMALVEE/NexBlog
github: https://github.com/0xMALVEE/zustand-nextjs-typescript-todo
JWT Authentication all you Need to Know
Tags: webdev, programming, productivity
Published: 2022-12-27 04:53:50

JWT (JSON Web Token) authentication is a popular method for securing REST (Representational State Transfer) APIs. JWTs are digital tokens that are used to authenticate users and authorize access to certain resources. In this article, we will discuss how JWT authentication works and some best practices for implementing it.

How JWT Authentication Works:

1.The user logs in and provides their credentials (such as a username and password).

2.The server verifies the credentials and, if they are valid, generates a JWT and sends it back to the user.

3.The user stores the JWT and sends it with each subsequent request to the server.

T4.he server verifies the JWT and, if it is valid, grants the user access to the requested resources.

Best Practices for Implementing JWT Authentication:

Use HTTPS: It is essential to use HTTPS (Hypertext Transfer Protocol Secure) when implementing JWT authentication, as this encrypts all traffic between the client and the server. This helps protect against man-in-the-middle attacks and ensures that sensitive data is not intercepted by third parties.

Use a secure signing algorithm: JWTs are signed using a secret key to ensure their authenticity. It is important to use a secure signing algorithm, such as HMAC (Hash-based Message Authentication Code) or RSA (Rivest-Shamir-Adleman), to sign your JWTs.

Use short expiration times: JWTs should have short expiration times (such as one hour or less) to ensure that they are not used for an extended period of time. This helps protect against the use of stolen or compromised JWTs.

Use refresh tokens: Refresh tokens can be used to obtain a new JWT without requiring the user to re-enter their credentials. This can be useful for maintaining a user's session, but it is important to implement refresh tokens securely to prevent unauthorized access.

Use input validation: It is important to validate all input received by your API to ensure that it is in the correct format and does not contain any malicious data. This can help prevent injection attacks and other security vulnerabilities.

By following these best practices, you can implement JWT authentication effectively and securely. This will help ensure that your API is protected and that only authorized users can access it.
Get a total of $100,000 in prize money by onboarding Dapp
Tags: blockchain, web3, dapp
Published: 2022-12-27 04:50:45

**What are DApps?**
DApps (Decentralized Applications) refer to services that operate through smart contracts on blockchains. They provide various services to their blockchains and help enrich their respective ecosystems. The increase in the number and activity of DApps leads to an increase in the inflow of users as well as liquidity into blockchains as observed in the cases such as Optimism and Arbitrum. Ultimately, DApps vitalize blockchains and contribute to creating a healthier ecosystem.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ht0ces573u3jesa2dfpp.png)
**About the BIFROST Network**
As the BIFROST Network is a permissionless EVM-compatible layer-one blockchain utilizing Substrate technology focused on enabling interoperability between blockchains, it provides the ultimate environment to build multichain DApps. For instance, the network allows one to purchase a BSC-based NFT using USDT on Ethereum.

BFC is the native token of the BIFROST Network which is a generalized message-passing system that is well-suited for all types of cross-chain applications. By design, it can operate with native tokens that inherit the security of the underlying network. The network allows developers to easily build cross-chain applications, such as a cross-chain DEX service using native assets.

**Evaluation and Reward Distribution**
Onboarded DApps will be evaluated based on their performance. Final scores will be calculated at the end of the program and each DApp will receive rewards according to the score ranking. Overall performance will be scored according to the following criteria.

- Number of transactions incurred (testnet and mainnet)

- Originality

- Ease of use

- Contribution to the blockchain ecosystem

As you can see, early participants are likely to have an upper hand in terms of transactions. Deploying a DApp on the testnet is also a good way to test the service’s potential performance on the mainnet. However, DApps creating transactions with any malicious intention will be disqualified.

A total reward of $100,000 has been allocated for this program. We encourage your participation as it’s not a winner-take-all system! Details about rewards and the scoring system will be revealed in the coming week.

Application form : https://docs.google.com/forms/d/e/1FAIpQLSf-ZA0E2vvwSvNjLfJ40ioYNm8GJJuG_N72d67qowO47BKLVg/viewform

Medium : https://medium.com/bifrost/introducing-the-bifrost-ecosystem-kickstart-initiative-896418ed19c1

Twitter : https://twitter.com/BIFROSTio

**Dates**
Start date: 5 December 2022

End date: 15 March 2023
Rotary Keyboard for nostalgic coders
Tags: webdev, programming
Published: 2022-12-27 04:50:31


![keyboard with rotary numbers](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6n493leczfuk7tsz5n1p.jpg)Keyboard for nostalgic coders :) 

https://squidgeefish.com/projects/rotary-keyboard/
Master AMPscript in Marketing Cloud
Tags: sfmc, salesforce, marketingcloud, ampscript
Published: 2022-12-27 04:37:53


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yoscp2w9zmrgpwtlofbm.png)



Salesforce Marketing Cloud AMPscript is a powerful scripting language that allows marketers to tailor and personalize their email campaigns to individual customers. With AMPscript, marketers can segment their email lists, insert dynamic content, and track the success of their campaigns.

AMPscript is particularly useful for marketers who want to create highly targeted and personalized emails. For example, you can use AMPscript to insert a customer’s first name into the subject line or body of an email, or to display different content to different segments of your email list based on their interests or behavior.

One of the key benefits of AMPscript is that it allows you to easily access and use data from your Salesforce Marketing Cloud account. This means you can pull in information about your customers, such as their preferences and purchase history, and use it to create more relevant and effective email campaigns.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7kmnzrenvg2ck4v51ww6.png)


To use AMPscript, you’ll need to have a Salesforce Marketing Cloud account and be familiar with the basic syntax of the language. AMPscript is similar to other programming languages, with variables, loops, and conditional statements that allow you to control the flow of your code.

To get started with AMPscript, you’ll need to create a new email template in your Marketing Cloud account and insert AMPscript blocks wherever you want to use dynamic content or access data from your account. You can then use AMPscript functions and variables to insert the desired content or data into your email template.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zhxn4x5ku5kby5r2vmhr.png)



Overall, AMPscript is a powerful tool for marketers looking to create highly targeted and personalized email campaigns. By leveraging the data and functionality of the Salesforce Marketing Cloud, AMPscript allows you to create emails that truly resonate with your audience and drive business results.
How to build and deploy secure rest api
Tags: webdev, programming, productivity
Published: 2022-12-27 04:33:54

Building and deploying a secure REST (Representational State Transfer) API is an important task for any software development team. A secure API is essential for protecting sensitive data and ensuring that only authorized users can access it. In this article, we will discuss some key considerations for building and deploying a secure REST API.

Use HTTPS: It is essential to use HTTPS (Hypertext Transfer Protocol Secure) for your API, as this encrypts all traffic between the client and the server. This helps protect against man-in-the-middle attacks and ensures that sensitive data is not intercepted by third parties.

Use authentication and authorization: It is important to implement authentication and authorization measures to ensure that only authorized users can access your API. This can include using API keys or OAuth for authentication, and implementing appropriate permissions for different users or groups.

Use encryption for sensitive data: If your API handles sensitive data (such as financial information or personal data), it is important to encrypt this data to protect it from unauthorized access. This can be done using techniques such as SSL (Secure Sockets Layer) or TLS (Transport Layer Security).

Implement rate limiting: Rate limiting is a technique for limiting the number of requests that can be made to your API within a certain time period. This can help prevent Denial of Service (DoS) attacks and ensure that your API is available to legitimate users.

Use input validation: It is important to validate all input received by your API to ensure that it is in the correct format and does not contain any malicious data. This can help prevent injection attacks and other security vulnerabilities.

Monitor and log activity: Monitoring and logging activity on your API can help you identify potential security issues and respond to them quickly. This can include tracking access attempts, error logs, and other relevant information.

By following these best practices, you can build and deploy a secure REST API that protects sensitive data and ensures that only authorized users can access it. This will help ensure that your API is reliable and efficient, and will help protect your users and your business.
Api architecture best practice for designing rest api
Tags: webdev, programming, productivity
Published: 2022-12-27 04:12:05

API (Application Programming Interface) architecture is an important aspect of software development, as it defines the way in which different systems and services interact with each other. REST (Representational State Transfer) APIs are a popular choice for designing APIs, as they are based on the HTTP protocol and are easy to use and understand. In this article, we will discuss some best practices for designing REST APIs.

Use a clear and consistent structure: It is important to have a clear and consistent structure for your API, as this makes it easier for developers to understand and use it. This can include using a consistent naming convention for endpoints and parameters, and organizing endpoints into logical groups.

Use HTTP status codes correctly: HTTP status codes are used to communicate the status of a request. It is important to use the correct status codes to provide clear and accurate information to developers using your API.

Use proper HTTP methods: HTTP methods (such as GET, POST, PUT, DELETE) should be used correctly to indicate the intended action for a request. For example, a GET request should be used to retrieve data, while a POST request should be used to create a new resource.

Use versioning: It is a good idea to version your API, as this allows you to make changes to the API without breaking existing integrations. This can be done by including the version number in the URL of the API (e.g. /v1/endpoint).

Use documentation: Proper documentation is essential for making your API easy to use and understand. This can include documentation for each endpoint, including a description of its functionality and any required parameters.

Use authentication and authorization: It is important to implement authentication and authorization measures to ensure that only authorized users can access your API. This can include using API keys or OAuth for authentication, and implementing appropriate permissions for different users or groups.

Use error handling: It is important to handle errors gracefully, as this can help prevent issues for developers using your API. This can include returning clear and descriptive error messages, and providing guidance on how to resolve the issue.

By following these best practices, you can design a REST API that is easy to use, maintain, and understand. This will make it easier for developers to integrate with your API and ensure that it is reliable and efficient.
I have error when use patchUserMetadata API belong to Auth0-js
Published: 2022-12-27 03:54:19

I’m trying to update metadata for users with pathUserMetadata. Below is my code:
```
 management = new auth0.Management({
    domain: environment.domain,
    token: this.cookieService.get('access_token'),
    clientId: environment.clientId,
    clientSecret: environment.cliendSecret,
    scope: 'create:users read:users update:users openid profile email',
});
```
```
this.auth0.management.patchUserMetadata(
        'auth0|xxx' , //of xxx
        userMetadata,
        (err, res) => {
          console.log('err', err);
          console.log('res', res);
        }
);

```
but it alway return
```
{
    "statusCode": 400,
    "error": "Bad Request",
    "message": "Bad HTTP authentication header format",
    "errorCode": "Bearer"
}
```
How can I run this API?
What are the limitations of ReactJS?
Tags: react, limitations, webdev, javascript
Published: 2022-12-27 03:53:08

ReactJS is one of the most popular javascript libraries and with so many advantages there are also few limitations that we should take care of while starting a project from scratch. It is also a very common question asked in the fresher level or expert level interview of Reactjs.

### Limitations with ReactJS

### 1. It's a library, not a framework
ReactJS library Covers only the UI Layers(create reusable components) of the app and nothing else. Which means we can not develop a full fledge front application using ReactJS. But for developing a full-fledged application we need to install other third-party packages like Redux, Mobx, React Router, etc. If we talk about Angular which is a framework, has all these features inbuilt that the dependencies on the third party is very less with Angular. And more dependecy on third party packages will create issues while upgrading the application to the latest version as it will create problems of compatibility, means upgrading the app to latest is very tedious job.

### 2. Use of JSX
Since with another framework like Angular, the template part is basically an HTML code in which data is bound so working on the template part is very easy for a React beginners. With ReactJS JSX(mix of HTML and JavaScript) is used which is a bit different than HTML code which is a little bit of time taking to understand for learners.

### 3. Lack of proper documentation
React is updating and accelerating very fastly which is not maintained in the document at the same time, due to that it's very difficult for a new developer to understand it.  The documentation of ReactJS is not good as Angular and also the content/Community Support of ReactJS is a little less than Angular.

### 4. Problem with SEO
The default apps created with ReactJS do not support SEO. It requires much expertise in ReactJS to develop an application that is SEO friendly so that the application will be properly indexed by Search Engines like Google.


Article was originally posted over [jsonworld](https://jsonworld.com/blog/what-are-the-limitations-of-reactjs)
Busbud une fuerzas
Published: 2022-12-27 02:38:29

Busbud, el portal líder global para viajes terrestres interurbanos que ayuda a viajeros a encontrar sus boletos fácil y rápido, con más de tres millones de rutas globales, se ha aliado con Betterez, el sistema líder de reservas y administración de boletos para operadores de transporte terrestre, dando soporte a más de 50 operadores. La fusión permitirá a Busbud acelerar la transformación digital del sector de  autobuses, ofrecer un mejor servicio a sus socios de transporte y capacitarlos para lograr más ventas, eficiencia e innovación en sus operaciones. Hoy, Busbud también recibe a Amadeus Ventures como inversor clave. 

Fundada en 2011, con sede en Toronto (Canadá), Betterez es pionera en la digitalización del sector de autobuses, creando el sistema de gestión de inventario y boletos para viajes terrestres (IMS) más fiable del sector hoy en día.

Busbud, basado en Montreal (Canadá), tiene la misión de revolucionar los viajes terrestres con movilidad inteligente, accesible y sostenible a todo el mundo. Recientemente anunció su fusión con Recorrido en Chile, posicionándose con mayor crecimiento en la región.
[https://www.espaciosantiagodigital.cl/](https://www.espaciosantiagodigital.cl/
)
[https://www.avozdocidadao.com/](https://www.avozdocidadao.com/
)
[https://www.riodejaneirodigital.com/](https://www.riodejaneirodigital.com/)
Pareja de emprendedores compartirán las 13 formas más sencillas y seguras de ganar dinero en internet
Published: 2022-12-27 02:33:07

Para nadie es un secreto que internet ha traído un sinnúmero de oportunidades para el desarrollo profesional de las personas, pues se ha convertido en un espacio en el que trabajar y ganar dinero es cada vez más sencillo. Aun así, son pocas las personas que han aprovechado estas oportunidades pues no cuentan con el conocimiento y las herramientas suficientes para hacerlo.

Por eso nació SoyZárate, una creada por la pareja de emprendedores Daniel Zárate y Paola Ferrer, con la cual buscan que más personas alrededor del mundo sepan cómo tener un ingreso adicional desde casa con solo tener un computador o un celular y conexión a internet. 

Su historia comienza en el 2020, momento en el que Zárate y Ferrer se enfrentaban a una crisis económica. A sus 20 y 23 años vivieron la quiebra de su negocio, tenían deudas de más de 2.000 dólares y no lograban conseguir empleo por cuenta de la pandemia. Una pesadilla para jóvenes de su edad. 

Sin embargo, gracias a Internet lograron encontrar una oportunidad de negocio muy próspera que hoy los tiene facturando más de 50 mil dólares al mes. Según cuenta Ferrer, todo inició luego de ver un anuncio en internet en el que un joven afirmaba haber ganado una importante suma de dinero y solo por estar desde casa con conexión a internet. 

Ante la necesidad que estaban viviendo y aunque estaban un poco incrédulos por la alternativa, los dos jóvenes accedieron a profundizar en esta oportunidad, que consistía en realizar una serie de ventas vía internet y conseguir una comisión por cada venta. 

Tomaron varios cursos y pusieron en marcha lo aprendido. Al principio no tuvieron resultados, ni un solo cliente llegaba. Pero al mejorar sus técnicas y profundizar en cómo realizarlo de una mejor manera con foco en el cliente, lograron en un mes facturar más de 13.000 dólares, salir de sus deudas y comenzar a cumplir el sueño que se habían prometido de vivir juntos.

Precisamente, a través de SoyZárate, la pareja busca que más personas tengan la misma experiencia que ellos en los negocios digitales, pero con todo el conocimiento necesario para ser exitosos desde un principio. Es por eso que brindan una serie de capacitaciones digitales en las que explican los métodos más eficaces y seguros para generar ingresos en internet. 
[https://www.espaciosantiagodigital.cl/](https://www.espaciosantiagodigital.cl/)
[https://www.avozdocidadao.com/](https://www.avozdocidadao.com/)
[https://www.riodejaneirodigital.com/](https://www.riodejaneirodigital.com/)
My React Native App - In-app Download
Published: 2022-12-27 02:18:18

Just to share a project with react native devs, especially. I built this app from the ground up. More apps next year.

Downloading files from within an app or from the app directly to your mobile device is called "in-app download".

But which one do you really think is better considering you have little disk space left or you don't have at all?

Like the one in the screenshot, I created a feature to download the movie and keep it on the app for offline streaming. Meaning it's only inside the app you get to watch the movie.

Note: this is a complete app written in React Native. I'm just pointing out a feature that catches my interest and feel like talking about it.

PS: technically, the icon you see in the screenshot with color gold circle was showing download icon before clicking on it to download the movie. But after you click on the download icon, it turns to the current icon as it is in the screenshot, showing its download progress. On complete, it shows a different video file icon. That is how I did it for now 😊.

Like I said earlier, more of this to come in 2023. #project #streaming #share #like
Do Software Testers Need to Learn Coding?
Tags: webdev, beginners, programming, tutorial
Published: 2022-12-27 02:10:52

Do Software Testers Need to Learn Coding : In this video, we are going to cover Do Software Testers Need to Learn Coding or is coding required for software testing?

✅ Download Notes -  https://sdet.live/notes

{% embed https://youtu.be/Kfewhx51K_0 %}

✅ Join Facebook Group :  http://bit.ly/learntesting2019

✅ Website:   https://scrolltest.com

✅ Website:   https://thetestingacademy.com

✅ Twitter: https://twitter.com/itstechmode

🚀 Tools and services I recommend:
Some of the courses that I recommend to become better Automation Tester 🙌🙌

✅API Testing - 
https://www.learnapitesting.com


✅Cypress Tutorial with LIVE Projects -
http://cypresstutorial.com


#softwaretesting #thetestingacademy #scrolltest #qa