Support the ongoing development of Laravel.io →
API Routing
Last updated 7 months ago.
0

Thank you very much, it solved itself.

Route::pattern ( 'method', '[a-z,_]+' );

Route::get('myclass/{method}', [App\Http\Controllers\Myclass::class, 'invoker']);

public function invoker($methodname){

if( method_exists($this, $methodname)){

  return $this->$methodname();

} else {

  return ["result"=>"error","description"=>"no methods"];

}

}

The display will disappear from the route list, but it may be secure the other way around. I'll try this for the time being as level 1.

0

Sign in to participate in this thread!

Cloudways

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.