File tree 1 file changed +4
-2
lines changed
application/controllers/api
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,6 @@ function __construct()
33
33
public function users_get ()
34
34
{
35
35
// Users from a data store e.g. database
36
- // $user = $this->some_model->getSomething($id);
37
36
$ users = [
38
37
[
'id ' =>
1 ,
'name ' =>
'John ' ,
'email ' =>
'[email protected] ' ,
'fact ' =>
'Loves coding ' ],
39
38
[
'id ' =>
2 ,
'name ' =>
'Jim ' ,
'email ' =>
'[email protected] ' ,
'fact ' =>
'Developed on CodeIgniter ' ],
@@ -42,7 +41,8 @@ public function users_get()
42
41
43
42
$ id = $ this ->get ('id ' );
44
43
45
- // If the id parameter and query parameter don't exist, return all users instead
44
+ // If the id parameter doesn't exist return all the users
45
+
46
46
if ($ id === NULL )
47
47
{
48
48
// Check if the users data store contains users (in case the database result returns NULL)
@@ -61,6 +61,8 @@ public function users_get()
61
61
}
62
62
}
63
63
64
+ // Find and return a single record for a particular user.
65
+
64
66
$ id = (int ) $ id ;
65
67
66
68
// Validate the id.
You can’t perform that action at this time.
0 commit comments