Skip to content

Commit 2cf55e5

Browse files
committed
Added even trigger on auth component
1 parent e20dfd4 commit 2cf55e5

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/Darryldecode/Backend/Base/Registrar/Registrar.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Registrar {
1313
/**
1414
* the laravel backend version
1515
*/
16-
const VERSION = '1.0.13';
16+
const VERSION = '1.0.14';
1717
const VERSION_NAME = 'Alpha';
1818

1919
/**

src/Darryldecode/Backend/Components/Auth/Controllers/AuthController.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Darryldecode\Backend\Base\Controllers\BaseController;
66

7+
use Illuminate\Contracts\Events\Dispatcher;
78
use Darryldecode\Backend\Components\User\Models\Throttle;
89
use Darryldecode\Backend\Components\User\Models\User;
910
use Darryldecode\Backend\Utility\Helpers;
@@ -35,9 +36,10 @@ public function getLogin()
3536
* @param Request $request
3637
* @param Throttle $throttle
3738
* @param User $user
39+
* @param Dispatcher $dispatcher
3840
* @return $this|\Illuminate\Http\RedirectResponse
3941
*/
40-
public function postLogin(Request $request, Throttle $throttle, User $user)
42+
public function postLogin(Request $request, Throttle $throttle, User $user, Dispatcher $dispatcher)
4143
{
4244
$credentials = $request->only('email', 'password');
4345

@@ -49,6 +51,8 @@ public function postLogin(Request $request, Throttle $throttle, User $user)
4951
// if authentication is good
5052
if( $result->isSuccessful() )
5153
{
54+
$dispatcher->fire('auth.loginSuccess', array($result->getData()));
55+
5256
if( $request->get('ru') != '' )
5357
{
5458
return redirect()->intended($request->get('ru'));
@@ -65,12 +69,15 @@ public function postLogin(Request $request, Throttle $throttle, User $user)
6569
/**
6670
* Log the user out of the application.
6771
*
72+
* @param Dispatcher $dispatcher
6873
* @return \Illuminate\Http\Response
6974
*/
70-
public function getLogout()
75+
public function getLogout(Dispatcher $dispatcher)
7176
{
7277
Auth::logout();
7378

79+
$dispatcher->fire('auth.logout');
80+
7481
return redirect(Helpers::getLoginRoute());
7582
}
7683
}

0 commit comments

Comments
 (0)