Skip to content

Instantly share code, notes, and snippets.

@Maras0830
Created June 4, 2016 04:10
Show Gist options
  • Save Maras0830/78270747080a3afc348b7e247ff7423c to your computer and use it in GitHub Desktop.
Save Maras0830/78270747080a3afc348b7e247ff7423c to your computer and use it in GitHub Desktop.
Register Laravel5 Event listen.
<?php
namespace App\Providers;
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
// 註冊自定義的監聽器
'App\Events\MemberLoginEvent' => [
'App\Handlers\Events\MemberLoginEventHandler',
],
];
/**
* Register any other events for your application.
*
* @param \Illuminate\Contracts\Events\Dispatcher $events
* @return void
*/
public function boot(DispatcherContract $events)
{
parent::boot($events);
//
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment