ken4ward
343
3
Lumen

Querying a single user from Lumen API

Posted 7 months ago by ken4ward

Kindly help me on how to write the api route on querying a single user. I have the one that returns all the records in the database.

This is the route

$api->group([ 'namespace' => 'App\Http\Controllers', 'middleware' => ['auth:api', 'cors'] ], function ($api)
    {
        $api->get( 'users', '[email protected]', );
    });

This is the controller

public function showOne( $id )
    {
       $user = $this->userRepository->getById( $id );
       $response = $this->response->item( $user, new Transformer() );
       return $response;
    }

Please sign in or create an account to participate in this conversation.