Support the ongoing development of Laravel.io →
API Routing
Last updated 2 years 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!

Eventy

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.

© 2024 Laravel.io - All rights reserved.