{"action":"created","comment":{"url":"https://api.github.com/repos/andela/suyabay/pulls/comments/59390306","id":59390306,"diff_hunk":"@@ -41,4 +41,45 @@ public function createNewApp()\n     {\n         return view('api.pages.mynewapp');\n     }\n+\n+    /**\n+     * Generate a token for user.\n+     *\n+     * @param int $userId\n+     *\n+     * @return string\n+     */\n+    public function generateToken()\n+    {\n+        $appSecret = getenv('APP_SECRET');\n+        $jwtAlgorithm = getenv('JWT_ALGORITHM');\n+        $timeIssued = time();\n+        $serverName = getenv('SERVERNAME');\n+        $tokenId = base64_encode(getenv('TOKENID'));\n+        $token = [\n+            'iss'  => $serverName,   //Issuer: the server name\n+            'iat'  => $timeIssued,   // Issued at: time when the token was generated\n+            'jti'  => $tokenId,          // Json Token Id: an unique identifier for the token\n+            'nbf'  => $timeIssued, //Not before time\n+            'exp'  => $timeIssued + 60 * 60 * 24 * 30, // expires in 30 days\n+        ];\n+        \n+        return JWT::encode($token, $appSecret, $jwtAlgorithm);\n+    }\n+\n+    /**\n+     * This method post the details from the user into the database\n+     *\n+     * @return \\Illuminate\\Http\\Response\n+     */\n+    public function postAppDetails(Request $request)","path":"app/Http/Controllers/ApiPagesController.php","position":53,"original_position":53,"commit_id":"13956c41d8748c533333a7a46df6b620f1f9ddc0","original_commit_id":"13956c41d8748c533333a7a46df6b620f1f9ddc0","user":{"login":"andela-oadebayo","id":9655574,"avatar_url":"https://avatars.githubusercontent.com/u/9655574?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-oadebayo","html_url":"https://github.com/andela-oadebayo","followers_url":"https://api.github.com/users/andela-oadebayo/followers","following_url":"https://api.github.com/users/andela-oadebayo/following{/other_user}","gists_url":"https://api.github.com/users/andela-oadebayo/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-oadebayo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-oadebayo/subscriptions","organizations_url":"https://api.github.com/users/andela-oadebayo/orgs","repos_url":"https://api.github.com/users/andela-oadebayo/repos","events_url":"https://api.github.com/users/andela-oadebayo/events{/privacy}","received_events_url":"https://api.github.com/users/andela-oadebayo/received_events","type":"User","site_admin":false},"body":"**Code Quality - Critical**\r\n@andela-araimi Good method name, but the method is confusing and incomplete, the annotation says it returns `\\Illuminate\\Http\\Response` but there is nothing being returned in this method. This method is meant to redirect to a new page with a success message or redirect back to the same page with an error message. And also there is no validation for this form post. Please fix all of this.","created_at":"2016-04-12T14:54:10Z","updated_at":"2016-04-12T14:54:10Z","html_url":"https://github.com/andela/suyabay/pull/257#discussion_r59390306","pull_request_url":"https://api.github.com/repos/andela/suyabay/pulls/257","_links":{"self":{"href":"https://api.github.com/repos/andela/suyabay/pulls/comments/59390306"},"html":{"href":"https://github.com/andela/suyabay/pull/257#discussion_r59390306"},"pull_request":{"href":"https://api.github.com/repos/andela/suyabay/pulls/257"}}},"pull_request":{"url":"https://api.github.com/repos/andela/suyabay/pulls/257","id":65522716,"html_url":"https://github.com/andela/suyabay/pull/257","diff_url":"https://github.com/andela/suyabay/pull/257.diff","patch_url":"https://github.com/andela/suyabay/pull/257.patch","issue_url":"https://api.github.com/repos/andela/suyabay/issues/257","number":257,"state":"open","locked":false,"title":"[#116873071] The Register Application button creates a new app with a JWT token","user":{"login":"andela-araimi","id":14159420,"avatar_url":"https://avatars.githubusercontent.com/u/14159420?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-araimi","html_url":"https://github.com/andela-araimi","followers_url":"https://api.github.com/users/andela-araimi/followers","following_url":"https://api.github.com/users/andela-araimi/following{/other_user}","gists_url":"https://api.github.com/users/andela-araimi/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-araimi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-araimi/subscriptions","organizations_url":"https://api.github.com/users/andela-araimi/orgs","repos_url":"https://api.github.com/users/andela-araimi/repos","events_url":"https://api.github.com/users/andela-araimi/events{/privacy}","received_events_url":"https://api.github.com/users/andela-araimi/received_events","type":"User","site_admin":false},"body":"#### What does this PR do?\r\n\r\nThe Register Application button creates a new app with a JWT token\r\n\r\n#### Description of Task to be completed?\r\n\r\n- Created a table with 8 columns, including id, user_id, name, home_url, description, api_token,      \r\n  created_at and updated_at using migration and model.\r\n\r\n- Write a method that generates the JWT token. \r\n\r\n- Write a method that saves the information inputted on the form by the user using eloquent. This method \r\n  saves the data and returns the JWT token from the JWT token method. In the subsequent PR, the \r\n  JWT token will be stored in the database.\r\n\r\n- The Register Application button create a new app with all the details and a suyabay JWT token that  \r\n  has an expiry date of 30 days\r\n\r\n- Write a method that displays all the apps created by the user.\r\n\r\n- In this PR, I also minified api.main.css file, converted the api.main.css file to api.main.sass. Any  \r\n  changes on the api.main.css file will be made on the  sass folder on api.main.sass.\r\n\r\n#### How should this be manually tested?\r\n\r\nNavigate to http://suyabay.app/developer/myapp/new which is a simple form. Fill the necessary field and hit 'SAVE CHANGES\". This will create the app and display the generated JWT token. To test if the app has been successfully created, navigate to this url: http://suyabay.app/developer/myapp/appinfos. You should see the list of the created app.\r\n\r\n#### Any background context you want to provide?\r\n\r\nNone\r\n\r\n#### What are the relevant pivotal tracker stories?\r\n\r\n- #116873071\r\n\r\n#### Screenshots (if appropriate)\r\n\r\n![screen shot 2016-04-06 at 8 26 45 pm](https://cloud.githubusercontent.com/assets/14159420/14329954/f42f8240-fc35-11e5-947d-5b5832b327ff.png)\r\n\r\nThis a sample of a generated JWT token.\r\n\r\n#### Questions:\r\n[@unicodeveloper](https://github.com/unicodeveloper)\r\n[@andela-oadebayo](https://github.com/andela-oadebayo)","created_at":"2016-04-06T19:31:55Z","updated_at":"2016-04-12T14:54:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"086cee3bb563cb2179315b21e4fedcc301ecfca1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/andela/suyabay/pulls/257/commits","review_comments_url":"https://api.github.com/repos/andela/suyabay/pulls/257/comments","review_comment_url":"https://api.github.com/repos/andela/suyabay/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andela/suyabay/issues/257/comments","statuses_url":"https://api.github.com/repos/andela/suyabay/statuses/13956c41d8748c533333a7a46df6b620f1f9ddc0","head":{"label":"andela:ft-save-button-create-a-new-app-with-token-#116873071","ref":"ft-save-button-create-a-new-app-with-token-#116873071","sha":"13956c41d8748c533333a7a46df6b620f1f9ddc0","user":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"repo":{"id":41855319,"name":"suyabay","full_name":"andela/suyabay","owner":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/andela/suyabay","description":"Awesome Podcast FM Network for Suya Lovers","fork":false,"url":"https://api.github.com/repos/andela/suyabay","forks_url":"https://api.github.com/repos/andela/suyabay/forks","keys_url":"https://api.github.com/repos/andela/suyabay/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela/suyabay/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela/suyabay/teams","hooks_url":"https://api.github.com/repos/andela/suyabay/hooks","issue_events_url":"https://api.github.com/repos/andela/suyabay/issues/events{/number}","events_url":"https://api.github.com/repos/andela/suyabay/events","assignees_url":"https://api.github.com/repos/andela/suyabay/assignees{/user}","branches_url":"https://api.github.com/repos/andela/suyabay/branches{/branch}","tags_url":"https://api.github.com/repos/andela/suyabay/tags","blobs_url":"https://api.github.com/repos/andela/suyabay/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela/suyabay/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela/suyabay/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela/suyabay/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela/suyabay/statuses/{sha}","languages_url":"https://api.github.com/repos/andela/suyabay/languages","stargazers_url":"https://api.github.com/repos/andela/suyabay/stargazers","contributors_url":"https://api.github.com/repos/andela/suyabay/contributors","subscribers_url":"https://api.github.com/repos/andela/suyabay/subscribers","subscription_url":"https://api.github.com/repos/andela/suyabay/subscription","commits_url":"https://api.github.com/repos/andela/suyabay/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela/suyabay/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela/suyabay/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela/suyabay/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela/suyabay/contents/{+path}","compare_url":"https://api.github.com/repos/andela/suyabay/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela/suyabay/merges","archive_url":"https://api.github.com/repos/andela/suyabay/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela/suyabay/downloads","issues_url":"https://api.github.com/repos/andela/suyabay/issues{/number}","pulls_url":"https://api.github.com/repos/andela/suyabay/pulls{/number}","milestones_url":"https://api.github.com/repos/andela/suyabay/milestones{/number}","notifications_url":"https://api.github.com/repos/andela/suyabay/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela/suyabay/labels{/name}","releases_url":"https://api.github.com/repos/andela/suyabay/releases{/id}","deployments_url":"https://api.github.com/repos/andela/suyabay/deployments","created_at":"2015-09-03T11:00:56Z","updated_at":"2016-03-11T18:32:31Z","pushed_at":"2016-04-12T09:44:00Z","git_url":"git://github.com/andela/suyabay.git","ssh_url":"git@github.com:andela/suyabay.git","clone_url":"https://github.com/andela/suyabay.git","svn_url":"https://github.com/andela/suyabay","homepage":"https://suyabay-staging.herokuapp.com","size":35444,"stargazers_count":8,"watchers_count":8,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":14,"forks":4,"open_issues":14,"watchers":8,"default_branch":"staging"}},"base":{"label":"andela:staging","ref":"staging","sha":"e9c990f55df9d4ffc443cefc0f748f31d8a0813b","user":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"repo":{"id":41855319,"name":"suyabay","full_name":"andela/suyabay","owner":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/andela/suyabay","description":"Awesome Podcast FM Network for Suya Lovers","fork":false,"url":"https://api.github.com/repos/andela/suyabay","forks_url":"https://api.github.com/repos/andela/suyabay/forks","keys_url":"https://api.github.com/repos/andela/suyabay/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela/suyabay/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela/suyabay/teams","hooks_url":"https://api.github.com/repos/andela/suyabay/hooks","issue_events_url":"https://api.github.com/repos/andela/suyabay/issues/events{/number}","events_url":"https://api.github.com/repos/andela/suyabay/events","assignees_url":"https://api.github.com/repos/andela/suyabay/assignees{/user}","branches_url":"https://api.github.com/repos/andela/suyabay/branches{/branch}","tags_url":"https://api.github.com/repos/andela/suyabay/tags","blobs_url":"https://api.github.com/repos/andela/suyabay/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela/suyabay/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela/suyabay/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela/suyabay/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela/suyabay/statuses/{sha}","languages_url":"https://api.github.com/repos/andela/suyabay/languages","stargazers_url":"https://api.github.com/repos/andela/suyabay/stargazers","contributors_url":"https://api.github.com/repos/andela/suyabay/contributors","subscribers_url":"https://api.github.com/repos/andela/suyabay/subscribers","subscription_url":"https://api.github.com/repos/andela/suyabay/subscription","commits_url":"https://api.github.com/repos/andela/suyabay/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela/suyabay/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela/suyabay/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela/suyabay/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela/suyabay/contents/{+path}","compare_url":"https://api.github.com/repos/andela/suyabay/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela/suyabay/merges","archive_url":"https://api.github.com/repos/andela/suyabay/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela/suyabay/downloads","issues_url":"https://api.github.com/repos/andela/suyabay/issues{/number}","pulls_url":"https://api.github.com/repos/andela/suyabay/pulls{/number}","milestones_url":"https://api.github.com/repos/andela/suyabay/milestones{/number}","notifications_url":"https://api.github.com/repos/andela/suyabay/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela/suyabay/labels{/name}","releases_url":"https://api.github.com/repos/andela/suyabay/releases{/id}","deployments_url":"https://api.github.com/repos/andela/suyabay/deployments","created_at":"2015-09-03T11:00:56Z","updated_at":"2016-03-11T18:32:31Z","pushed_at":"2016-04-12T09:44:00Z","git_url":"git://github.com/andela/suyabay.git","ssh_url":"git@github.com:andela/suyabay.git","clone_url":"https://github.com/andela/suyabay.git","svn_url":"https://github.com/andela/suyabay","homepage":"https://suyabay-staging.herokuapp.com","size":35444,"stargazers_count":8,"watchers_count":8,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":14,"forks":4,"open_issues":14,"watchers":8,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/andela/suyabay/pulls/257"},"html":{"href":"https://github.com/andela/suyabay/pull/257"},"issue":{"href":"https://api.github.com/repos/andela/suyabay/issues/257"},"comments":{"href":"https://api.github.com/repos/andela/suyabay/issues/257/comments"},"review_comments":{"href":"https://api.github.com/repos/andela/suyabay/pulls/257/comments"},"review_comment":{"href":"https://api.github.com/repos/andela/suyabay/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andela/suyabay/pulls/257/commits"},"statuses":{"href":"https://api.github.com/repos/andela/suyabay/statuses/13956c41d8748c533333a7a46df6b620f1f9ddc0"}}}}