Run function from Button or URL in Laravel -


i have following test function, want call directly url or clicking link blade view.

public function callmedirectlyfromurl() {     return "i have been called url :)"; } 

my question: possible call function directly button-click or url link blade view in laravel?

here solution:

we assume have function callmedirectlyfromurl in yourcontroller, here how can call function directly url, hyperlink or button.

create route

route::get('/pagelink', 'yourcontroller@callmedirectlyfromurl'); 

add link in view blade php file

<a href="{{action('yourcontroller@callmedirectlyfromurl')}}">link name/embedded button</a> 

this has been tested on laravel 4.2 -> 5.2 far.

by clicking on link or call url www.somedomain.com/pagelink function executed directly.


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -