4
4
5
5
use Darryldecode \Backend \Base \Controllers \BaseController ;
6
6
7
+ use Illuminate \Contracts \Events \Dispatcher ;
7
8
use Darryldecode \Backend \Components \User \Models \Throttle ;
8
9
use Darryldecode \Backend \Components \User \Models \User ;
9
10
use Darryldecode \Backend \Utility \Helpers ;
@@ -35,9 +36,10 @@ public function getLogin()
35
36
* @param Request $request
36
37
* @param Throttle $throttle
37
38
* @param User $user
39
+ * @param Dispatcher $dispatcher
38
40
* @return $this|\Illuminate\Http\RedirectResponse
39
41
*/
40
- public function postLogin (Request $ request , Throttle $ throttle , User $ user )
42
+ public function postLogin (Request $ request , Throttle $ throttle , User $ user, Dispatcher $ dispatcher )
41
43
{
42
44
$ credentials = $ request ->only ('email ' , 'password ' );
43
45
@@ -49,6 +51,8 @@ public function postLogin(Request $request, Throttle $throttle, User $user)
49
51
// if authentication is good
50
52
if ( $ result ->isSuccessful () )
51
53
{
54
+ $ dispatcher ->fire ('auth.loginSuccess ' , array ($ result ->getData ()));
55
+
52
56
if ( $ request ->get ('ru ' ) != '' )
53
57
{
54
58
return redirect ()->intended ($ request ->get ('ru ' ));
@@ -65,12 +69,15 @@ public function postLogin(Request $request, Throttle $throttle, User $user)
65
69
/**
66
70
* Log the user out of the application.
67
71
*
72
+ * @param Dispatcher $dispatcher
68
73
* @return \Illuminate\Http\Response
69
74
*/
70
- public function getLogout ()
75
+ public function getLogout (Dispatcher $ dispatcher )
71
76
{
72
77
Auth::logout ();
73
78
79
+ $ dispatcher ->fire ('auth.logout ' );
80
+
74
81
return redirect (Helpers::getLoginRoute ());
75
82
}
76
83
}
0 commit comments