Example #1
0
 public static function boot()
 {
     parent::boot();
     // Setup event bindings...
     Category::creating(function ($category) {
     });
     Category::saving(function ($category) {
     });
     Category::created(function ($category) {
         \Queue::push(new CategoryQueue($category->id));
     });
     Category::updated(function ($category) {
         \Queue::push(new CategoryQueue($category->id));
     });
     Category::deleting(function ($category) {
         // TODO: Check whether there is a queue job with this - Locking?
     });
     Category::deleted(function ($category) {
         \DB::table('project_category')->where('category_id', $category->id)->delete();
     });
 }