Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
What is the best practice for sending emails from MVC based platform ?
Should I rather send emails from controller or model ? What is the best practice ?
One opinion is that model should send emails, just to keep controller slimest possible, other opinion is that controller should send emails, because model shouldn't have access to services.
Thanks for contribution to this topic.
I'd be hard pressed to find a situation where it made more sense to send an email from the Model...
Without knowing the specifics of your architecture, I'd wager that the Controller should be the one to send emails, for two reasons:
As you mentioned, the model shouldn't have access to services
The email is most likely being sent as a result of some user interaction, which puts it squarely in the domain of the Controller.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I'm creating an erp with laravel + larvel nova, a rest api with laravel and frontend with vuejs. My doubt is: where should i build my database migration as better practice, should i put my migration in my erp project or in my api rest project. Both will use the same database.
My suggestion is to create your migration in Rest Api beacuse api most work is in database and you want to give data(which is in Database) to user in most cases with Api!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am using Mailchimp campaign to send emails but when i tried to save data in the list from my sql with laravel hit they just blocked my account any solution of this you can see the screenshot.
Contact their Developers and use contact forum You will get the solution by them may be your account is not supporting their terms and conditions.They are always on monday to friday
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I am new to APIs. I want to make an API-centric Laravel web app and an Android app. They will use private API.
I am not sure how to make the user auth for the API. I have read many articles about JWT and many more about OAuth2 but I am still not sure which one to use and how to actually make it.
I recommend that you read through this very digestable book - https://apisyouwonthate.com/. It helps with the theory and the implementation of an API in Laravel. Although the code is specifically for Laravel 4, virtually everything in the book is still helpful.
Starting in Laravel 5.2, the framework has been providing support for token authentication and web form authentication right out of the box. https://www.laravel.com/docs/5.3/passport
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I would like to implement a "guided" photo browsing. That is, when one web-site visitor chooses to be in the guided mode and another to be a guide, the former sees photos chosen by the latter.
This is similar to what Google Drive simultaneous editing looks like, when one user sees changes by another user in real time. So I was wondering if I could just use the same technology. Does anyone know how it is implemented? Also any comments on whether it would be suitable for me would be appreciated.
You can use a real time socket messaging like https://www.pubnub.com/
The user that wants to see the photos will subscribe to a channel where the messages will be sent. The message gets to the user immediately.
The application will read the message in JSON format. You can include the photo name/title as well as the URL. You will process the message and load the image.
Here is an example of how they implemented a stream of Hacker News articles:
https://www.pubnub.com/developers/data-streams/hacker-news-articles
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
we are working on a restful system. On the front-end side we use angular js and on the back-end side spring. Now one of the question is: how ensure that the exchanged object on the two side on the time remain consistent. I don't mean the realtime exchange of data that are persisted on DB, I mean the consistency of the programming objects.
Example: front-end sends a user objects with the fields: firstname and lastname, and the backend takes this object user with firstname and lastname.
In the future it can be that a field must change his meaning: for example firstname becomes name. Now the front-end can't speak with the backend.
The best way to cover this is to write integration test: from front-end to DB. But is there not a better way to test only this "exchange-layer"?
One idea that i had is to put this objects (java class for backend and angular file) in a separate library, and make some control on the equals of the fields. But is this the best way to do that? Any idea how make this better?
For this case if you´re using Spring and modelAndAttribute, as soon as you changes one of the side client/server and an entity attribute name you will receive a BindingResult Exception from the framework. The only way to test this is by integration tests with selenium. Which will made the whole client/server transaction in the test to check that everything still working properly without any exception.
Read the documentation of how to integrated with Spring MVC https://spring.io/blog/2014/03/26/spring-mvc-test-with-webdriver