Skip to content
Advertisement

Laravel how to add a function from a view to the controller (Business Logic Layer)

I currently have this function in my view:

JavaScript

I would like to know if its possible to add this to my controller so my view only has to display the result.

This is my controller:

JavaScript

this is my model:

JavaScript

Now the problem is the controller doesn’t know stuff like DateTime()

What the function does is if the users has something wich is past the current date it will send an email to the user. But now each time the user reloads the page it send the email again. This function is there to stop that but it doesnt work in my view:

JavaScript

This does not change the column email_send to 1 from 0 in the table SSL in my database.

Is it possible to add this code to my controller(or model)? and so that the column does update in the database?

my user table migration:

JavaScript

Advertisement

Answer

Fixed my issue.. I just changed my controller to:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement