1
votes

I have a Laravel/Angular application I am working on.

In public/app/js are all of my Angular files.

Should I just collect the data in Angular, send an HTTP request, and use Laravel's validation class to handle validation (and creating of the record) for registration and everything else?

Or should I use Angular to take care of the validation and keep Laravel only as the API endpoint for CRUD operations?

I'm new to frontend JavaScript frameworks and appreciate any insight or advice.

1

1 Answers

0
votes

Never rely on the frontend for validating input.

The validation should alwasy be done in the backend (for security reasons). Validation is also useful in the frontend in order to be able to provide immediate feedback to the user (but always in addition to server-side validation).


So the answer is that you probably need to have both frameworks validate the user's input:

  • Angular: For better user experience
  • Laravel: For security.