{"action":"created","comment":{"url":"https://api.github.com/repos/snipe/snipe-it/pulls/comments/36251280","id":36251280,"diff_hunk":"@@ -1,85 +1,193 @@\n <?php\n \n-class Actionlog extends Eloquent\n-{\n-\tuse SoftDeletingTrait;\n-    protected $dates = ['deleted_at'];\n+    use Illuminate\\Database\\Eloquent\\SoftDeletingTrait;\n+    use Illuminate\\Support\\Facades\\DB;\n+    use Illuminate\\Support\\Facades\\Log;\n \n-    protected $table = 'asset_logs';\n-    public $timestamps = true;\n-    protected $fillable = ['created_at'];\n+    class Actionlog extends Eloquent\n+    {\n \n+        use SoftDeletingTrait;\n+        protected $dates = [ 'deleted_at' ];\n \n-    public function assetlog()\n-    {\n-        return $this->belongsTo('Asset','asset_id')->withTrashed();\n-    }\n+        protected $table      = 'asset_logs';\n+        public    $timestamps = true;\n+        protected $fillable   = [ 'created_at' ];\n \n-     public function uploads()\n-    {\n-        return $this->belongsTo('Asset','asset_id')->where('action_type','=','uploaded')->withTrashed();\n-    }\n+        public function assetlog()\n+        {\n \n-    public function licenselog()\n-    {\n-        return $this->belongsTo('License','asset_id')->withTrashed();\n-    }\n+            return $this->belongsTo( 'Asset', 'asset_id' )\n+                        ->withTrashed();\n+        }\n \n-    public function accessorylog()\n-    {\n-        return $this->belongsTo('Accessory','accessory_id')->withTrashed();\n-    }\n+        public function uploads()\n+        {\n \n-\tpublic function consumablelog()\n-    {\n-        return $this->belongsTo('Consumable','consumable_id')->withTrashed();\n-    }\n+            return $this->belongsTo( 'Asset', 'asset_id' )\n+                        ->where( 'action_type', '=', 'uploaded' )\n+                        ->withTrashed();\n+        }\n \n-    public function adminlog()\n-    {\n-        return $this->belongsTo('User','user_id')->withTrashed();\n-    }\n+        public function licenselog()\n+        {\n \n-    public function userlog()\n-    {\n-        return $this->belongsTo('User','checkedout_to')->withTrashed();\n-    }\n+            return $this->belongsTo( 'License', 'asset_id' )\n+                        ->withTrashed();\n+        }\n \n-    public function childlogs()\n-    {\n+        public function accessorylog()\n+        {\n \n-        return $this->hasMany( 'ActionLog', 'thread_id' );\n-    }\n+            return $this->belongsTo( 'Accessory', 'accessory_id' )\n+                        ->withTrashed();\n+        }\n \n-    public function parentlog()\n-    {\n+        public function consumablelog()\n+        {\n \n-        return $this->belongsTo( 'ActionLog', 'thread_id' );\n-    }\n+            return $this->belongsTo( 'Consumable', 'consumable_id' )\n+                        ->withTrashed();\n+        }\n \n-    /**\n-\t* Check if the file exists, and if it does, force a download\n-\t**/\n-    public function get_src() {\n+        public function adminlog()\n+        {\n \n-\t\t\t$file = app_path().'/private_uploads/'.$this->filename;\n-\t\t\treturn $file;\n+            return $this->belongsTo( 'User', 'user_id' )\n+                        ->withTrashed();\n+        }\n \n-    }\n+        public function userlog()\n+        {\n \n+            return $this->belongsTo( 'User', 'checkedout_to' )\n+                        ->withTrashed();\n+        }\n \n+        public function childlogs()\n+        {\n \n-    /**\n-    * Get the parent category name\n-    */\n-    public function logaction($actiontype)\n-    {\n-        $this->action_type = $actiontype;\n+            return $this->hasMany( 'ActionLog', 'thread_id' );\n+        }\n \n-        if($this->save()) {\n-            return true;\n-        } else {\n-            return false;\n+        public function parentlog()\n+        {\n+\n+            return $this->belongsTo( 'ActionLog', 'thread_id' );\n+        }\n+\n+        /**\n+         * Check if the file exists, and if it does, force a download\n+         **/\n+        public function get_src()\n+        {\n+\n+            $file = app_path() . '/private_uploads/' . $this->filename;\n+\n+            return $file;\n+\n+        }\n+\n+        /**\n+         * Get the parent category name\n+         */\n+        public function logaction( $actiontype )\n+        {\n+\n+            $this->action_type = $actiontype;\n+\n+            if ($this->save()) {\n+                return true;\n+            } else {\n+                return false;\n+            }\n         }\n-    }\n-}\n+\n+        /**\n+         * getUnacceptedAssets\n+         * @param array $listOfAssets\n+         *\n+         * @return mixed\n+         * @static\n+         * @author  Vincent Sposato <vincent.sposato@gmail.com>\n+         * @version v1.0\n+         */\n+        public static function getUnacceptedAssets( $listOfAssets = [ '*' ] )\n+        {\n+\n+            $assetIds = implode( \",\", $listOfAssets );","path":"app/models/Actionlog.php","position":180,"original_position":180,"commit_id":"4082957c851182e0931b7e25fdbae9e1c16fa0ef","original_commit_id":"4082957c851182e0931b7e25fdbae9e1c16fa0ef","user":{"login":"snipe","id":197404,"avatar_url":"https://avatars.githubusercontent.com/u/197404?v=3","gravatar_id":"","url":"https://api.github.com/users/snipe","html_url":"https://github.com/snipe","followers_url":"https://api.github.com/users/snipe/followers","following_url":"https://api.github.com/users/snipe/following{/other_user}","gists_url":"https://api.github.com/users/snipe/gists{/gist_id}","starred_url":"https://api.github.com/users/snipe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snipe/subscriptions","organizations_url":"https://api.github.com/users/snipe/orgs","repos_url":"https://api.github.com/users/snipe/repos","events_url":"https://api.github.com/users/snipe/events{/privacy}","received_events_url":"https://api.github.com/users/snipe/received_events","type":"User","site_admin":false},"body":"Can we get this a little more ORM-y? This will break if people are using table prefixes, since it's a raw query. ","created_at":"2015-08-04T22:39:58Z","updated_at":"2015-08-04T22:39:58Z","html_url":"https://github.com/snipe/snipe-it/pull/1001#discussion_r36251280","pull_request_url":"https://api.github.com/repos/snipe/snipe-it/pulls/1001","_links":{"self":{"href":"https://api.github.com/repos/snipe/snipe-it/pulls/comments/36251280"},"html":{"href":"https://github.com/snipe/snipe-it/pull/1001#discussion_r36251280"},"pull_request":{"href":"https://api.github.com/repos/snipe/snipe-it/pulls/1001"}}},"pull_request":{"url":"https://api.github.com/repos/snipe/snipe-it/pulls/1001","id":41405980,"html_url":"https://github.com/snipe/snipe-it/pull/1001","diff_url":"https://github.com/snipe/snipe-it/pull/1001.diff","patch_url":"https://github.com/snipe/snipe-it/pull/1001.patch","issue_url":"https://api.github.com/repos/snipe/snipe-it/issues/1001","number":1001,"state":"closed","locked":false,"title":"Feature/865 assets not accepted report","user":{"login":"vsposato","id":894126,"avatar_url":"https://avatars.githubusercontent.com/u/894126?v=3","gravatar_id":"","url":"https://api.github.com/users/vsposato","html_url":"https://github.com/vsposato","followers_url":"https://api.github.com/users/vsposato/followers","following_url":"https://api.github.com/users/vsposato/following{/other_user}","gists_url":"https://api.github.com/users/vsposato/gists{/gist_id}","starred_url":"https://api.github.com/users/vsposato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsposato/subscriptions","organizations_url":"https://api.github.com/users/vsposato/orgs","repos_url":"https://api.github.com/users/vsposato/repos","events_url":"https://api.github.com/users/vsposato/events{/privacy}","received_events_url":"https://api.github.com/users/vsposato/received_events","type":"User","site_admin":false},"body":"Added a new command - app:thread_asset_log which will properly thread all of the action logs within the system.\r\n\r\nCreated the report and the export of the assets unaccepted by the checked out user.\r\n\r\nStill need to consider how to update the thread_ids after each action","created_at":"2015-08-01T18:44:08Z","updated_at":"2015-08-04T22:39:59Z","closed_at":"2015-08-02T18:06:42Z","merged_at":"2015-08-02T18:06:42Z","merge_commit_sha":"3bbbec5cb8787cc30616a30e4105313df68de8ca","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/snipe/snipe-it/pulls/1001/commits","review_comments_url":"https://api.github.com/repos/snipe/snipe-it/pulls/1001/comments","review_comment_url":"https://api.github.com/repos/snipe/snipe-it/pulls/comments{/number}","comments_url":"https://api.github.com/repos/snipe/snipe-it/issues/1001/comments","statuses_url":"https://api.github.com/repos/snipe/snipe-it/statuses/4082957c851182e0931b7e25fdbae9e1c16fa0ef","head":{"label":"vsposato:feature/865_AssetsNotAcceptedReport","ref":"feature/865_AssetsNotAcceptedReport","sha":"4082957c851182e0931b7e25fdbae9e1c16fa0ef","user":{"login":"vsposato","id":894126,"avatar_url":"https://avatars.githubusercontent.com/u/894126?v=3","gravatar_id":"","url":"https://api.github.com/users/vsposato","html_url":"https://github.com/vsposato","followers_url":"https://api.github.com/users/vsposato/followers","following_url":"https://api.github.com/users/vsposato/following{/other_user}","gists_url":"https://api.github.com/users/vsposato/gists{/gist_id}","starred_url":"https://api.github.com/users/vsposato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsposato/subscriptions","organizations_url":"https://api.github.com/users/vsposato/orgs","repos_url":"https://api.github.com/users/vsposato/repos","events_url":"https://api.github.com/users/vsposato/events{/privacy}","received_events_url":"https://api.github.com/users/vsposato/received_events","type":"User","site_admin":false},"repo":{"id":37770274,"name":"snipe-it","full_name":"vsposato/snipe-it","owner":{"login":"vsposato","id":894126,"avatar_url":"https://avatars.githubusercontent.com/u/894126?v=3","gravatar_id":"","url":"https://api.github.com/users/vsposato","html_url":"https://github.com/vsposato","followers_url":"https://api.github.com/users/vsposato/followers","following_url":"https://api.github.com/users/vsposato/following{/other_user}","gists_url":"https://api.github.com/users/vsposato/gists{/gist_id}","starred_url":"https://api.github.com/users/vsposato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsposato/subscriptions","organizations_url":"https://api.github.com/users/vsposato/orgs","repos_url":"https://api.github.com/users/vsposato/repos","events_url":"https://api.github.com/users/vsposato/events{/privacy}","received_events_url":"https://api.github.com/users/vsposato/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vsposato/snipe-it","description":"A free open source IT asset/license management system built in PHP on Laravel 4.2 and Bootstrap 3. ","fork":true,"url":"https://api.github.com/repos/vsposato/snipe-it","forks_url":"https://api.github.com/repos/vsposato/snipe-it/forks","keys_url":"https://api.github.com/repos/vsposato/snipe-it/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vsposato/snipe-it/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vsposato/snipe-it/teams","hooks_url":"https://api.github.com/repos/vsposato/snipe-it/hooks","issue_events_url":"https://api.github.com/repos/vsposato/snipe-it/issues/events{/number}","events_url":"https://api.github.com/repos/vsposato/snipe-it/events","assignees_url":"https://api.github.com/repos/vsposato/snipe-it/assignees{/user}","branches_url":"https://api.github.com/repos/vsposato/snipe-it/branches{/branch}","tags_url":"https://api.github.com/repos/vsposato/snipe-it/tags","blobs_url":"https://api.github.com/repos/vsposato/snipe-it/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vsposato/snipe-it/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vsposato/snipe-it/git/refs{/sha}","trees_url":"https://api.github.com/repos/vsposato/snipe-it/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vsposato/snipe-it/statuses/{sha}","languages_url":"https://api.github.com/repos/vsposato/snipe-it/languages","stargazers_url":"https://api.github.com/repos/vsposato/snipe-it/stargazers","contributors_url":"https://api.github.com/repos/vsposato/snipe-it/contributors","subscribers_url":"https://api.github.com/repos/vsposato/snipe-it/subscribers","subscription_url":"https://api.github.com/repos/vsposato/snipe-it/subscription","commits_url":"https://api.github.com/repos/vsposato/snipe-it/commits{/sha}","git_commits_url":"https://api.github.com/repos/vsposato/snipe-it/git/commits{/sha}","comments_url":"https://api.github.com/repos/vsposato/snipe-it/comments{/number}","issue_comment_url":"https://api.github.com/repos/vsposato/snipe-it/issues/comments{/number}","contents_url":"https://api.github.com/repos/vsposato/snipe-it/contents/{+path}","compare_url":"https://api.github.com/repos/vsposato/snipe-it/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vsposato/snipe-it/merges","archive_url":"https://api.github.com/repos/vsposato/snipe-it/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vsposato/snipe-it/downloads","issues_url":"https://api.github.com/repos/vsposato/snipe-it/issues{/number}","pulls_url":"https://api.github.com/repos/vsposato/snipe-it/pulls{/number}","milestones_url":"https://api.github.com/repos/vsposato/snipe-it/milestones{/number}","notifications_url":"https://api.github.com/repos/vsposato/snipe-it/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vsposato/snipe-it/labels{/name}","releases_url":"https://api.github.com/repos/vsposato/snipe-it/releases{/id}","created_at":"2015-06-20T13:12:54Z","updated_at":"2015-06-20T13:12:56Z","pushed_at":"2015-08-01T18:41:24Z","git_url":"git://github.com/vsposato/snipe-it.git","ssh_url":"git@github.com:vsposato/snipe-it.git","clone_url":"https://github.com/vsposato/snipe-it.git","svn_url":"https://github.com/vsposato/snipe-it","homepage":"http://snipeitapp.com","size":9689,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"snipe:2.0","ref":"2.0","sha":"37d4a0105eb2a361b493ab504b22383d400d4356","user":{"login":"snipe","id":197404,"avatar_url":"https://avatars.githubusercontent.com/u/197404?v=3","gravatar_id":"","url":"https://api.github.com/users/snipe","html_url":"https://github.com/snipe","followers_url":"https://api.github.com/users/snipe/followers","following_url":"https://api.github.com/users/snipe/following{/other_user}","gists_url":"https://api.github.com/users/snipe/gists{/gist_id}","starred_url":"https://api.github.com/users/snipe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snipe/subscriptions","organizations_url":"https://api.github.com/users/snipe/orgs","repos_url":"https://api.github.com/users/snipe/repos","events_url":"https://api.github.com/users/snipe/events{/privacy}","received_events_url":"https://api.github.com/users/snipe/received_events","type":"User","site_admin":false},"repo":{"id":14346979,"name":"snipe-it","full_name":"snipe/snipe-it","owner":{"login":"snipe","id":197404,"avatar_url":"https://avatars.githubusercontent.com/u/197404?v=3","gravatar_id":"","url":"https://api.github.com/users/snipe","html_url":"https://github.com/snipe","followers_url":"https://api.github.com/users/snipe/followers","following_url":"https://api.github.com/users/snipe/following{/other_user}","gists_url":"https://api.github.com/users/snipe/gists{/gist_id}","starred_url":"https://api.github.com/users/snipe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snipe/subscriptions","organizations_url":"https://api.github.com/users/snipe/orgs","repos_url":"https://api.github.com/users/snipe/repos","events_url":"https://api.github.com/users/snipe/events{/privacy}","received_events_url":"https://api.github.com/users/snipe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/snipe/snipe-it","description":"A free open source IT asset/license management system built in PHP on Laravel 4.2 and Bootstrap 3. ","fork":false,"url":"https://api.github.com/repos/snipe/snipe-it","forks_url":"https://api.github.com/repos/snipe/snipe-it/forks","keys_url":"https://api.github.com/repos/snipe/snipe-it/keys{/key_id}","collaborators_url":"https://api.github.com/repos/snipe/snipe-it/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/snipe/snipe-it/teams","hooks_url":"https://api.github.com/repos/snipe/snipe-it/hooks","issue_events_url":"https://api.github.com/repos/snipe/snipe-it/issues/events{/number}","events_url":"https://api.github.com/repos/snipe/snipe-it/events","assignees_url":"https://api.github.com/repos/snipe/snipe-it/assignees{/user}","branches_url":"https://api.github.com/repos/snipe/snipe-it/branches{/branch}","tags_url":"https://api.github.com/repos/snipe/snipe-it/tags","blobs_url":"https://api.github.com/repos/snipe/snipe-it/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/snipe/snipe-it/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/snipe/snipe-it/git/refs{/sha}","trees_url":"https://api.github.com/repos/snipe/snipe-it/git/trees{/sha}","statuses_url":"https://api.github.com/repos/snipe/snipe-it/statuses/{sha}","languages_url":"https://api.github.com/repos/snipe/snipe-it/languages","stargazers_url":"https://api.github.com/repos/snipe/snipe-it/stargazers","contributors_url":"https://api.github.com/repos/snipe/snipe-it/contributors","subscribers_url":"https://api.github.com/repos/snipe/snipe-it/subscribers","subscription_url":"https://api.github.com/repos/snipe/snipe-it/subscription","commits_url":"https://api.github.com/repos/snipe/snipe-it/commits{/sha}","git_commits_url":"https://api.github.com/repos/snipe/snipe-it/git/commits{/sha}","comments_url":"https://api.github.com/repos/snipe/snipe-it/comments{/number}","issue_comment_url":"https://api.github.com/repos/snipe/snipe-it/issues/comments{/number}","contents_url":"https://api.github.com/repos/snipe/snipe-it/contents/{+path}","compare_url":"https://api.github.com/repos/snipe/snipe-it/compare/{base}...{head}","merges_url":"https://api.github.com/repos/snipe/snipe-it/merges","archive_url":"https://api.github.com/repos/snipe/snipe-it/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/snipe/snipe-it/downloads","issues_url":"https://api.github.com/repos/snipe/snipe-it/issues{/number}","pulls_url":"https://api.github.com/repos/snipe/snipe-it/pulls{/number}","milestones_url":"https://api.github.com/repos/snipe/snipe-it/milestones{/number}","notifications_url":"https://api.github.com/repos/snipe/snipe-it/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/snipe/snipe-it/labels{/name}","releases_url":"https://api.github.com/repos/snipe/snipe-it/releases{/id}","created_at":"2013-11-12T22:25:47Z","updated_at":"2015-08-04T19:37:40Z","pushed_at":"2015-08-04T21:55:16Z","git_url":"git://github.com/snipe/snipe-it.git","ssh_url":"git@github.com:snipe/snipe-it.git","clone_url":"https://github.com/snipe/snipe-it.git","svn_url":"https://github.com/snipe/snipe-it","homepage":"http://snipeitapp.com","size":19879,"stargazers_count":426,"watchers_count":426,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":205,"mirror_url":null,"open_issues_count":103,"forks":205,"open_issues":103,"watchers":426,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/snipe/snipe-it/pulls/1001"},"html":{"href":"https://github.com/snipe/snipe-it/pull/1001"},"issue":{"href":"https://api.github.com/repos/snipe/snipe-it/issues/1001"},"comments":{"href":"https://api.github.com/repos/snipe/snipe-it/issues/1001/comments"},"review_comments":{"href":"https://api.github.com/repos/snipe/snipe-it/pulls/1001/comments"},"review_comment":{"href":"https://api.github.com/repos/snipe/snipe-it/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/snipe/snipe-it/pulls/1001/commits"},"statuses":{"href":"https://api.github.com/repos/snipe/snipe-it/statuses/4082957c851182e0931b7e25fdbae9e1c16fa0ef"}}}}