Skip to content

Instantly share code, notes, and snippets.

@vojtasvoboda
Created January 4, 2016 10:45
Show Gist options
  • Save vojtasvoboda/56d6bd003c3bf9d0d440 to your computer and use it in GitHub Desktop.
Save vojtasvoboda/56d6bd003c3bf9d0d440 to your computer and use it in GitHub Desktop.
Listen on Eloquent events in OctoberCMS
<?php
// ...
public function boot()
{
// Event Listeners for RainLab Blog
Event::listen('eloquent.created: RainLab\Blog\Models\Post', function($model) {
// ... do something
});
Event::listen('eloquent.saved: RainLab\Blog\Models\Post', function($model) {
// ... do something
});
Event::listen('eloquent.deleted: RainLab\Blog\Models\Post', function($model) {
// ... do something
});
// Event Listeners for SoBoRed settings
Event::listen('eloquent.saved: SoBoRed\Rss\Models\Settings', function($model) {
// ... do something
});
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment