{"action":"closed","issue":{"url":"https://api.github.com/repos/NtimYeboah/laravel-database-trigger/issues/1","repository_url":"https://api.github.com/repos/NtimYeboah/laravel-database-trigger","labels_url":"https://api.github.com/repos/NtimYeboah/laravel-database-trigger/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/NtimYeboah/laravel-database-trigger/issues/1/comments","events_url":"https://api.github.com/repos/NtimYeboah/laravel-database-trigger/issues/1/events","html_url":"https://github.com/NtimYeboah/laravel-database-trigger/issues/1","id":309287646,"node_id":"MDU6SXNzdWUzMDkyODc2NDY=","number":1,"title":"Trigger API","user":{"login":"NtimYeboah","id":8011922,"node_id":"MDQ6VXNlcjgwMTE5MjI=","avatar_url":"https://avatars3.githubusercontent.com/u/8011922?v=4","gravatar_id":"","url":"https://api.github.com/users/NtimYeboah","html_url":"https://github.com/NtimYeboah","followers_url":"https://api.github.com/users/NtimYeboah/followers","following_url":"https://api.github.com/users/NtimYeboah/following{/other_user}","gists_url":"https://api.github.com/users/NtimYeboah/gists{/gist_id}","starred_url":"https://api.github.com/users/NtimYeboah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NtimYeboah/subscriptions","organizations_url":"https://api.github.com/users/NtimYeboah/orgs","repos_url":"https://api.github.com/users/NtimYeboah/repos","events_url":"https://api.github.com/users/NtimYeboah/events{/privacy}","received_events_url":"https://api.github.com/users/NtimYeboah/received_events","type":"User","site_admin":false},"labels":[{"id":882313134,"node_id":"MDU6TGFiZWw4ODIzMTMxMzQ=","url":"https://api.github.com/repos/NtimYeboah/laravel-database-trigger/labels/Discussion","name":"Discussion","color":"bf2ad6","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-28T09:27:29Z","updated_at":"2018-09-20T18:15:59Z","closed_at":"2018-09-20T18:15:59Z","author_association":"OWNER","body":"### Description:\r\nCurrently, the trigger api has 3 methods:- `insert`, `update` and `statement`\r\n\r\n1. `insert` - Run statements to insert into a table when a trigger is called\r\n```php\r\nSchema::create('before_employees_update, 'employees', function(QueryStatement $query) {\r\n    $query->insert('employees_audit', function() {\r\n         return 'first_name=old.first_name';\r\n    })\r\n})->before()->update();\r\n```\r\n\r\n2. `update` - Run statements to update a table when a trigger is called\r\n```php\r\nSchema::create('before_employees_update', 'employees', function(QueryStatement $query) {\r\n    $query->update('employees_audit', function() {\r\n         return 'first_name=old.first_name';\r\n    })\r\n})->before()->update();\r\n```\r\n\r\n3. `statement` - Run arbitrary sql statements when trigger is called\r\n```php\r\nSchema::create('after_orders_update', 'employees', function(QueryStatement $query) {\r\n    $query->statement(function() {\r\n         return \"delete from orders where status = 'pending'\";\r\n    })\r\n})->after()->update();\r\n```\r\n\r\nCan the API be simplified, do we need to add or take away some methods?\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"NtimYeboah"}}