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 - ScrollTo Effect (href to div) -

javascript - ng-class not responding to change in model in Angular? -

javascript - document.registerElement extending HTMLInputElement prototype while using custom tag name to avoid implicit browser style -