Skip to content
Advertisement

Comparing user submitted data, then sending a response back

newbie here

I apologize for the cryptic title, I’m new to Laravel and PHP.

I’m building a CTF application using Laravel Jetstream with LiveWire as part of a university project.

Users will submit flags they’ve found, and I want that data to be compared with a database entry. If they flag is correct, I want this to be shown:

JavaScript

If they got it wrong, I want this to be displayed:

JavaScript

I have most of this code in place, but I’m not sure how to get the logic or routes to work with LiveWire. I have a controller, FlagVerification that has some of the logic, but I’m mainly stuck on how to move this information between the controller and the view, and how to use LiveWire to update what the user sees

Here’s my controller so far:

JavaScript

This is what the frontend looks like, it might help give a better idea of the goal imgur[.]com/a/U8ItJuT

I realise this is a lot to ask, so any pointers or tips would be really appreciated

Thank you!

Advertisement

Answer

first of all, if you want to get data by id, use: Flag::find($id);

And in your code, you check not user data, you check data from the database with this: OBR{1FA528F41E8945C}

If you want to check data from user with your database data, your code should be something like that:

JavaScript

And this is your html:

JavaScript

Hope I`ve answered on your question 🙂

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