jacksunny/eventprocess

There is no license information available for the latest version (v1.0) of this package.

simple event process plugin including dispatching on tree for laravel framework

v1.0 2017-08-08 03:35 UTC

This package is not auto-updated.

Last update: 2024-11-24 04:21:42 UTC


README

simple event process plugin including dispatching on tree for laravel framework

How to install and configurate package

  1. install the laravel package composer require "jacksunny/eventprocess":"dev-master"

please check exist line "minimum-stability": "dev" in composer.json if failed

  1. append new service provider file line in the section providers of file app.config after appended,it should looks like
   'providers' => [
        Illuminate\Auth\AuthServiceProvider::class,
        ......
        Jacksunny\EventProcess\EventProcessServiceProvider::class,
    ],
   
  1. create event class TestEvent

    class TestEvent extends BaseEvent implements EventContract {
    
    public $context_obj;
    
    public function __construct(User $user, Request $request, $entity, $action_name, array $options = null, TreeWalkerContract $tree_walker = null) {
        parent::__construct($tree_walker, $user, $request, $entity, $action_name, $options);
        $this->context_obj = $user;
    }
    
  2. create event listener class TestEventListener

    class TestEventListener extends BaseEventListener implements EventListenerContract {
    
    public function __construct() {
        parent::__construct($this);
    }
    
    public function handle(TestEvent $event) {
        parent::handle($event);
    
        //other process code on this event type
    }
    
  3. please notify me if you got any problem or error on it,thank you!