File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
application/controllers/api Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,6 @@ function __construct()
3333 public function users_get ()
3434 {
3535 // Users from a data store e.g. database
36- // $user = $this->some_model->getSomething($id);
3736 $ users = [
3837 [
'id ' =>
1 ,
'name ' =>
'John ' ,
'email ' =>
'[email protected] ' ,
'fact ' =>
'Loves coding ' ],
3938 [
'id ' =>
2 ,
'name ' =>
'Jim ' ,
'email ' =>
'[email protected] ' ,
'fact ' =>
'Developed on CodeIgniter ' ],
@@ -42,7 +41,8 @@ public function users_get()
4241
4342 $ id = $ this ->get ('id ' );
4443
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+
4646 if ($ id === NULL )
4747 {
4848 // Check if the users data store contains users (in case the database result returns NULL)
@@ -61,6 +61,8 @@ public function users_get()
6161 }
6262 }
6363
64+ // Find and return a single record for a particular user.
65+
6466 $ id = (int ) $ id ;
6567
6668 // Validate the id.
You can’t perform that action at this time.
0 commit comments