Example for API
This commit is contained in:
parent
cce4b1f186
commit
0393733bcd
@ -2,16 +2,19 @@
|
|||||||
|
|
||||||
namespace WebProjectFitness\API;
|
namespace WebProjectFitness\API;
|
||||||
|
|
||||||
|
use WebProjectFitness\Model\BDTables;
|
||||||
|
use WebProjectFitness\Model\Model;
|
||||||
|
|
||||||
class APIUser extends API {
|
class APIUser extends API {
|
||||||
|
|
||||||
private $declaredFunctions = [
|
private $declaredFunctions = [
|
||||||
'create' => [
|
'create' => [
|
||||||
'method' => 'POST',
|
'method' => 'GET',
|
||||||
'params' => [
|
'params' => [
|
||||||
'id' => [
|
// 'id' => [
|
||||||
'required' => true,
|
// 'required' => true,
|
||||||
'type' => 'string'
|
// 'type' => 'string'
|
||||||
]
|
// ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
@ -21,7 +24,11 @@ class APIUser extends API {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function create( $data ) {
|
public function create( $data ) {
|
||||||
$this->returnJson( [ 'body' => 'truc', 'id' => $data[ 'id' ] ] );
|
Model::insert( BDTables::USER, [
|
||||||
|
"name" => "Mathi",
|
||||||
|
"user_id" => "bite"
|
||||||
|
] );
|
||||||
|
$this->returnJson( [ 'body' => 'truc' ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -8,6 +8,10 @@ abstract class BDTables {
|
|||||||
// Ex : const ABONNEMENT = 'abonnement';
|
// Ex : const ABONNEMENT = 'abonnement';
|
||||||
|
|
||||||
const LOGS = "logs";
|
const LOGS = "logs";
|
||||||
|
const USER = "user";
|
||||||
|
const FAVORITE = "favorite";
|
||||||
|
const EXERCISE = "exercise";
|
||||||
|
const TRAINING = "training";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue
Block a user