55 lines
1.2 KiB
PHP
55 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
|
|
use App\Models\SmartdokProfile;
|
|
|
|
class SmartdokProfileController extends Controller
|
|
{
|
|
/**
|
|
* List all users
|
|
*
|
|
* Returns a JSON array of all the smartdok users registered on the system
|
|
*
|
|
* @response \App\Models\SmartdokProfile
|
|
*/
|
|
public function index() {
|
|
$profiles = SmartdokProfile::all()->map(function ($p) {
|
|
return [
|
|
'Id' => $p->id,
|
|
'UserName' => $p->username,
|
|
'Name' => $p->name,
|
|
];
|
|
});
|
|
|
|
return response()->json($profiles);
|
|
}
|
|
|
|
/**
|
|
* Get a user
|
|
*
|
|
* Returns a JSON array of all the smartdok users registered on the system
|
|
*
|
|
* @param $id
|
|
*
|
|
* Example response:
|
|
* {
|
|
* "Id": "00000000-0000-0000-0000-000000000000",
|
|
* "UserName": "string",
|
|
* "Name": "string"
|
|
* }
|
|
*/
|
|
public function show(string $id) {
|
|
$p = SmartdokProfile::findOrFail($id);
|
|
|
|
return response()->json([
|
|
'Id' => $p->id,
|
|
'UserName' => $p->username,
|
|
'Name' => $p->name,
|
|
]);
|
|
}
|
|
}
|