Welcome Guest, Not a member yet? Register   Sign In
Customizing ResourceController Routes
#1

(This post was last modified: 09-03-2021, 11:15 AM by rafinhaa.)

I have this controller:

PHP Code:
class Auth extends ResourceController
{    
    
protected $format    'json';

 public function 
__construct(){
 }
    public function login(){        
        
die('login');
    }
    public function logout(){
        die('logout');
    }





There's a way to create a route using $routes->resource, for example (or some way to create a similar one):
PHP Code:
$routes->resource('api/v1/auth', [
'post' => 'Api\V1\Auth::login',
'get' => 'Api\V1\Auth::logout',
]); 

Another question...

If I have other methods within my ResourceController, how can I customize these routes?
Ex: I already have a ResourceController Groups and the route $routes->resource('api/v1/groups');
But this controller has two more methods listUsersGroups and listGroupsPermissions, how can I add these new routes in my $routes->resource('api/v1/groups');

Thank you all
Reply




Theme © iAndrew 2016 - Forum software by © MyBB