Sushant97
5 months ago

Dynamically creating a button with a URL

Posted 5 months ago by Sushant97

I wish to create a button on a view dynamically when a registration takes place. Consider a registration view called regView.blade.php that registers, say, subjects. So the form has a "Subject Name" field.

Whenever user registers a new subject, I want a button to be created with the name of the subject. Consider a view targetView.blade.php which is dynamically populated based on what subject name comes from the url.

This newly created button appends the subject_name to a view's URL, like:

laravel.dev/targetView/{subject_name}

Based on what button is pressed, the URL will vary, and so will the targetView contents. This can be done by handling the route using a controller.

I want to make that URL-making button dynamically on say buttonView.blade.php for every new subject registered via regView.blade.php

Can you suggest me how I can do it?

Please sign in or create an account to participate in this conversation.