@@ -54,7 +54,7 @@ |
||
| 54 | 54 | * Set the dependencies. |
| 55 | 55 | * |
| 56 | 56 | * @author Andrea Marco Sartori |
| 57 | - * @param Cerbero\Auth\Services\Dispatcher\DispatcherInterface $bus |
|
| 57 | + * @param DispatcherInterface $bus |
|
| 58 | 58 | * @return void |
| 59 | 59 | */ |
| 60 | 60 | public function __construct(DispatcherInterface $bus) |
@@ -14,187 +14,187 @@ |
||
| 14 | 14 | |
| 15 | 15 | class AuthController extends Controller { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * @author Andrea Marco Sartori |
|
| 19 | - * @var Cerbero\Auth\Services\Dispatcher\DispatcherInterface $bus Bus dispatcher. |
|
| 20 | - */ |
|
| 21 | - protected $bus; |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * @author Andrea Marco Sartori |
|
| 25 | - * @var array $loginPipes List of pipes for the login process. |
|
| 26 | - */ |
|
| 27 | - protected $loginPipes = ['DispatchEvent', 'Throttle']; |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * @author Andrea Marco Sartori |
|
| 31 | - * @var array $logoutPipes List of pipes for the logout process. |
|
| 32 | - */ |
|
| 33 | - protected $logoutPipes = ['DispatchEvent']; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * @author Andrea Marco Sartori |
|
| 37 | - * @var array $registerPipes List of pipes for the register process. |
|
| 38 | - */ |
|
| 39 | - protected $registerPipes = ['DispatchEvent', 'Login', 'Notify', 'Hash']; |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * @author Andrea Marco Sartori |
|
| 43 | - * @var array $recoverPipes List of pipes for the password recover process. |
|
| 44 | - */ |
|
| 45 | - protected $recoverPipes = ['DispatchEvent', 'Notify', 'Store']; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * @author Andrea Marco Sartori |
|
| 49 | - * @var array $resetPipes List of pipes for the password reset process. |
|
| 50 | - */ |
|
| 51 | - protected $resetPipes = ['DispatchEvent']; |
|
| 17 | + /** |
|
| 18 | + * @author Andrea Marco Sartori |
|
| 19 | + * @var Cerbero\Auth\Services\Dispatcher\DispatcherInterface $bus Bus dispatcher. |
|
| 20 | + */ |
|
| 21 | + protected $bus; |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * @author Andrea Marco Sartori |
|
| 25 | + * @var array $loginPipes List of pipes for the login process. |
|
| 26 | + */ |
|
| 27 | + protected $loginPipes = ['DispatchEvent', 'Throttle']; |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * @author Andrea Marco Sartori |
|
| 31 | + * @var array $logoutPipes List of pipes for the logout process. |
|
| 32 | + */ |
|
| 33 | + protected $logoutPipes = ['DispatchEvent']; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * @author Andrea Marco Sartori |
|
| 37 | + * @var array $registerPipes List of pipes for the register process. |
|
| 38 | + */ |
|
| 39 | + protected $registerPipes = ['DispatchEvent', 'Login', 'Notify', 'Hash']; |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * @author Andrea Marco Sartori |
|
| 43 | + * @var array $recoverPipes List of pipes for the password recover process. |
|
| 44 | + */ |
|
| 45 | + protected $recoverPipes = ['DispatchEvent', 'Notify', 'Store']; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * @author Andrea Marco Sartori |
|
| 49 | + * @var array $resetPipes List of pipes for the password reset process. |
|
| 50 | + */ |
|
| 51 | + protected $resetPipes = ['DispatchEvent']; |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Set the dependencies. |
|
| 55 | - * |
|
| 56 | - * @author Andrea Marco Sartori |
|
| 57 | - * @param Cerbero\Auth\Services\Dispatcher\DispatcherInterface $bus |
|
| 58 | - * @return void |
|
| 59 | - */ |
|
| 60 | - public function __construct(DispatcherInterface $bus) |
|
| 61 | - { |
|
| 62 | - $this->bus = $bus; |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * Display the login page. |
|
| 67 | - * |
|
| 68 | - * @author Andrea Marco Sartori |
|
| 69 | - * @return Illuminate\Http\Response |
|
| 70 | - */ |
|
| 71 | - public function showLogin() |
|
| 72 | - { |
|
| 73 | - $login = config('_auth.login.view'); |
|
| 74 | - |
|
| 75 | - return view($login); |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * Log the user in. |
|
| 80 | - * |
|
| 81 | - * @author Andrea Marco Sartori |
|
| 82 | - * @return Illuminate\Http\RedirectResponse |
|
| 83 | - */ |
|
| 84 | - public function login(LoginRequest $request) |
|
| 85 | - { |
|
| 86 | - $this->bus->pipeThrough($this->pipesOf('login'))->dispatchFrom(LoginJob::class, $request); |
|
| 87 | - |
|
| 88 | - return redirect()->route(config('_auth.login.redirect')); |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * Retrieve the pipes of a given process. |
|
| 93 | - * |
|
| 94 | - * @author Andrea Marco Sartori |
|
| 95 | - * @param string $process |
|
| 96 | - * @return array |
|
| 97 | - */ |
|
| 98 | - protected function pipesOf($process) |
|
| 99 | - { |
|
| 100 | - $Process = ucfirst($process); |
|
| 101 | - |
|
| 102 | - return array_map(function($pipe) use($Process) |
|
| 103 | - { |
|
| 104 | - return "Cerbero\Auth\Pipes\\{$Process}\\{$pipe}"; |
|
| 105 | - |
|
| 106 | - }, $this->{"{$process}Pipes"}); |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * Log the user out. |
|
| 111 | - * |
|
| 112 | - * @author Andrea Marco Sartori |
|
| 113 | - * @return Illuminate\Http\RedirectResponse |
|
| 114 | - */ |
|
| 115 | - public function logout() |
|
| 116 | - { |
|
| 117 | - $this->bus->pipeThrough($this->pipesOf('logout'))->dispatchNow(new LogoutJob); |
|
| 118 | - |
|
| 119 | - return redirect()->route(config('_auth.logout.redirect')); |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * Display the registration page. |
|
| 124 | - * |
|
| 125 | - * @author Andrea Marco Sartori |
|
| 126 | - * @return Illuminate\Http\Response |
|
| 127 | - */ |
|
| 128 | - public function showRegister() |
|
| 129 | - { |
|
| 130 | - $register = config('_auth.register.view'); |
|
| 131 | - |
|
| 132 | - return view($register); |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * Register the user. |
|
| 137 | - * |
|
| 138 | - * @author Andrea Marco Sartori |
|
| 139 | - * @return Illuminate\Http\RedirectResponse |
|
| 140 | - */ |
|
| 141 | - public function register(RegisterRequest $request) |
|
| 142 | - { |
|
| 143 | - $this->bus->pipeThrough($this->pipesOf('register'))->dispatchFrom(RegisterJob::class, $request); |
|
| 144 | - |
|
| 145 | - return redirect()->route(config('_auth.register.redirect'))->withSuccess(trans('auth::register.success')); |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - /** |
|
| 149 | - * Display the recover page. |
|
| 150 | - * |
|
| 151 | - * @author Andrea Marco Sartori |
|
| 152 | - * @return Illuminate\Http\Response |
|
| 153 | - */ |
|
| 154 | - public function showRecover() |
|
| 155 | - { |
|
| 156 | - $recover = config('_auth.recover.view'); |
|
| 157 | - |
|
| 158 | - return view($recover); |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - /** |
|
| 162 | - * Remember the user password. |
|
| 163 | - * |
|
| 164 | - * @author Andrea Marco Sartori |
|
| 165 | - * @return Illuminate\Http\RedirectResponse |
|
| 166 | - */ |
|
| 167 | - public function recover(RecoverRequest $request) |
|
| 168 | - { |
|
| 169 | - $this->bus->pipeThrough($this->pipesOf('recover'))->dispatchFrom(RecoverJob::class, $request); |
|
| 170 | - |
|
| 171 | - return back()->withSuccess(trans('auth::recover.success')); |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - /** |
|
| 175 | - * Display the reset page. |
|
| 176 | - * |
|
| 177 | - * @author Andrea Marco Sartori |
|
| 178 | - * @return Illuminate\Http\Response |
|
| 179 | - */ |
|
| 180 | - public function showReset($token) |
|
| 181 | - { |
|
| 182 | - $reset = config('_auth.reset.view'); |
|
| 183 | - |
|
| 184 | - return view($reset); |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - /** |
|
| 188 | - * Reset the user password. |
|
| 189 | - * |
|
| 190 | - * @author Andrea Marco Sartori |
|
| 191 | - * @return Illuminate\Http\RedirectResponse |
|
| 192 | - */ |
|
| 193 | - public function reset(ResetRequest $request, $token) |
|
| 194 | - { |
|
| 195 | - $this->bus->pipeThrough($this->pipesOf('reset'))->dispatchFrom(ResetJob::class, $request, compact('token')); |
|
| 196 | - |
|
| 197 | - return redirect()->route('login.index')->withSuccess(trans('auth::reset.success')); |
|
| 198 | - } |
|
| 53 | + /** |
|
| 54 | + * Set the dependencies. |
|
| 55 | + * |
|
| 56 | + * @author Andrea Marco Sartori |
|
| 57 | + * @param Cerbero\Auth\Services\Dispatcher\DispatcherInterface $bus |
|
| 58 | + * @return void |
|
| 59 | + */ |
|
| 60 | + public function __construct(DispatcherInterface $bus) |
|
| 61 | + { |
|
| 62 | + $this->bus = $bus; |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * Display the login page. |
|
| 67 | + * |
|
| 68 | + * @author Andrea Marco Sartori |
|
| 69 | + * @return Illuminate\Http\Response |
|
| 70 | + */ |
|
| 71 | + public function showLogin() |
|
| 72 | + { |
|
| 73 | + $login = config('_auth.login.view'); |
|
| 74 | + |
|
| 75 | + return view($login); |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * Log the user in. |
|
| 80 | + * |
|
| 81 | + * @author Andrea Marco Sartori |
|
| 82 | + * @return Illuminate\Http\RedirectResponse |
|
| 83 | + */ |
|
| 84 | + public function login(LoginRequest $request) |
|
| 85 | + { |
|
| 86 | + $this->bus->pipeThrough($this->pipesOf('login'))->dispatchFrom(LoginJob::class, $request); |
|
| 87 | + |
|
| 88 | + return redirect()->route(config('_auth.login.redirect')); |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * Retrieve the pipes of a given process. |
|
| 93 | + * |
|
| 94 | + * @author Andrea Marco Sartori |
|
| 95 | + * @param string $process |
|
| 96 | + * @return array |
|
| 97 | + */ |
|
| 98 | + protected function pipesOf($process) |
|
| 99 | + { |
|
| 100 | + $Process = ucfirst($process); |
|
| 101 | + |
|
| 102 | + return array_map(function($pipe) use($Process) |
|
| 103 | + { |
|
| 104 | + return "Cerbero\Auth\Pipes\\{$Process}\\{$pipe}"; |
|
| 105 | + |
|
| 106 | + }, $this->{"{$process}Pipes"}); |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * Log the user out. |
|
| 111 | + * |
|
| 112 | + * @author Andrea Marco Sartori |
|
| 113 | + * @return Illuminate\Http\RedirectResponse |
|
| 114 | + */ |
|
| 115 | + public function logout() |
|
| 116 | + { |
|
| 117 | + $this->bus->pipeThrough($this->pipesOf('logout'))->dispatchNow(new LogoutJob); |
|
| 118 | + |
|
| 119 | + return redirect()->route(config('_auth.logout.redirect')); |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * Display the registration page. |
|
| 124 | + * |
|
| 125 | + * @author Andrea Marco Sartori |
|
| 126 | + * @return Illuminate\Http\Response |
|
| 127 | + */ |
|
| 128 | + public function showRegister() |
|
| 129 | + { |
|
| 130 | + $register = config('_auth.register.view'); |
|
| 131 | + |
|
| 132 | + return view($register); |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * Register the user. |
|
| 137 | + * |
|
| 138 | + * @author Andrea Marco Sartori |
|
| 139 | + * @return Illuminate\Http\RedirectResponse |
|
| 140 | + */ |
|
| 141 | + public function register(RegisterRequest $request) |
|
| 142 | + { |
|
| 143 | + $this->bus->pipeThrough($this->pipesOf('register'))->dispatchFrom(RegisterJob::class, $request); |
|
| 144 | + |
|
| 145 | + return redirect()->route(config('_auth.register.redirect'))->withSuccess(trans('auth::register.success')); |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + /** |
|
| 149 | + * Display the recover page. |
|
| 150 | + * |
|
| 151 | + * @author Andrea Marco Sartori |
|
| 152 | + * @return Illuminate\Http\Response |
|
| 153 | + */ |
|
| 154 | + public function showRecover() |
|
| 155 | + { |
|
| 156 | + $recover = config('_auth.recover.view'); |
|
| 157 | + |
|
| 158 | + return view($recover); |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + /** |
|
| 162 | + * Remember the user password. |
|
| 163 | + * |
|
| 164 | + * @author Andrea Marco Sartori |
|
| 165 | + * @return Illuminate\Http\RedirectResponse |
|
| 166 | + */ |
|
| 167 | + public function recover(RecoverRequest $request) |
|
| 168 | + { |
|
| 169 | + $this->bus->pipeThrough($this->pipesOf('recover'))->dispatchFrom(RecoverJob::class, $request); |
|
| 170 | + |
|
| 171 | + return back()->withSuccess(trans('auth::recover.success')); |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + /** |
|
| 175 | + * Display the reset page. |
|
| 176 | + * |
|
| 177 | + * @author Andrea Marco Sartori |
|
| 178 | + * @return Illuminate\Http\Response |
|
| 179 | + */ |
|
| 180 | + public function showReset($token) |
|
| 181 | + { |
|
| 182 | + $reset = config('_auth.reset.view'); |
|
| 183 | + |
|
| 184 | + return view($reset); |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + /** |
|
| 188 | + * Reset the user password. |
|
| 189 | + * |
|
| 190 | + * @author Andrea Marco Sartori |
|
| 191 | + * @return Illuminate\Http\RedirectResponse |
|
| 192 | + */ |
|
| 193 | + public function reset(ResetRequest $request, $token) |
|
| 194 | + { |
|
| 195 | + $this->bus->pipeThrough($this->pipesOf('reset'))->dispatchFrom(ResetJob::class, $request, compact('token')); |
|
| 196 | + |
|
| 197 | + return redirect()->route('login.index')->withSuccess(trans('auth::reset.success')); |
|
| 198 | + } |
|
| 199 | 199 | |
| 200 | 200 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | * Set the dependencies. |
| 39 | 39 | * |
| 40 | 40 | * @author Andrea Marco Sartori |
| 41 | - * @param Illuminate\Contracts\Bus\Dispatcher $dispatcher |
|
| 41 | + * @param Dispatcher $dispatcher |
|
| 42 | 42 | * @return void |
| 43 | 43 | */ |
| 44 | 44 | public function __construct(Dispatcher $dispatcher) |
@@ -16,54 +16,54 @@ discard block |
||
| 16 | 16 | class MarshalDispatcher implements DispatcherInterface |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @author Andrea Marco Sartori |
|
| 21 | - * @var Illuminate\Contracts\Bus\Dispatcher $dispatcher Bus dispatcher. |
|
| 22 | - */ |
|
| 23 | - protected $dispatcher; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * @author Andrea Marco Sartori |
|
| 27 | - * @var string $command Command to dispatch |
|
| 28 | - */ |
|
| 29 | - protected $command; |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * @author Andrea Marco Sartori |
|
| 33 | - * @var \ArrayAccess $values Parameters values |
|
| 34 | - */ |
|
| 35 | - protected $values; |
|
| 19 | + /** |
|
| 20 | + * @author Andrea Marco Sartori |
|
| 21 | + * @var Illuminate\Contracts\Bus\Dispatcher $dispatcher Bus dispatcher. |
|
| 22 | + */ |
|
| 23 | + protected $dispatcher; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * @author Andrea Marco Sartori |
|
| 27 | + * @var string $command Command to dispatch |
|
| 28 | + */ |
|
| 29 | + protected $command; |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * @author Andrea Marco Sartori |
|
| 33 | + * @var \ArrayAccess $values Parameters values |
|
| 34 | + */ |
|
| 35 | + protected $values; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Set the dependencies. |
|
| 39 | - * |
|
| 40 | - * @author Andrea Marco Sartori |
|
| 41 | - * @param Illuminate\Contracts\Bus\Dispatcher $dispatcher |
|
| 42 | - * @return void |
|
| 43 | - */ |
|
| 44 | - public function __construct(Dispatcher $dispatcher) |
|
| 45 | - { |
|
| 46 | - $this->dispatcher = $dispatcher; |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - /** |
|
| 37 | + /** |
|
| 38 | + * Set the dependencies. |
|
| 39 | + * |
|
| 40 | + * @author Andrea Marco Sartori |
|
| 41 | + * @param Illuminate\Contracts\Bus\Dispatcher $dispatcher |
|
| 42 | + * @return void |
|
| 43 | + */ |
|
| 44 | + public function __construct(Dispatcher $dispatcher) |
|
| 45 | + { |
|
| 46 | + $this->dispatcher = $dispatcher; |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | 50 | * Set the pipes commands should be piped through before dispatching. |
| 51 | 51 | * |
| 52 | - * @author Andrea Marco Sartori |
|
| 52 | + * @author Andrea Marco Sartori |
|
| 53 | 53 | * @param array $pipes |
| 54 | 54 | * @return $this |
| 55 | 55 | */ |
| 56 | 56 | public function pipeThrough(array $pipes) |
| 57 | 57 | { |
| 58 | - $this->dispatcher->pipeThrough($pipes); |
|
| 58 | + $this->dispatcher->pipeThrough($pipes); |
|
| 59 | 59 | |
| 60 | - return $this; |
|
| 60 | + return $this; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * Marshal a command and dispatch it. |
| 65 | 65 | * |
| 66 | - * @author Andrea Marco Sartori |
|
| 66 | + * @author Andrea Marco Sartori |
|
| 67 | 67 | * @param mixed $command |
| 68 | 68 | * @param \ArrayAccess $source |
| 69 | 69 | * @param array $extras |
@@ -71,17 +71,17 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function dispatchFrom($command, ArrayAccess $source, array $extras = []) |
| 73 | 73 | { |
| 74 | - $this->command = $command; |
|
| 74 | + $this->command = $command; |
|
| 75 | 75 | |
| 76 | - $this->values = array_merge((array) $source, $extras); |
|
| 76 | + $this->values = array_merge((array) $source, $extras); |
|
| 77 | 77 | |
| 78 | - return $this->dispatcher->dispatch($this->marshal()); |
|
| 78 | + return $this->dispatcher->dispatch($this->marshal()); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Marshal the command to dispatch. |
| 83 | 83 | * |
| 84 | - * @author Andrea Marco Sartori |
|
| 84 | + * @author Andrea Marco Sartori |
|
| 85 | 85 | * @return mixed |
| 86 | 86 | */ |
| 87 | 87 | protected function marshal() |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | /** |
| 115 | 115 | * Get a parameter value for a marshaled command. |
| 116 | 116 | * |
| 117 | - * @author Andrea Marco Sartori |
|
| 117 | + * @author Andrea Marco Sartori |
|
| 118 | 118 | * @param \ReflectionParameter $parameter |
| 119 | 119 | * @return mixed |
| 120 | 120 | */ |
@@ -104,7 +104,7 @@ |
||
| 104 | 104 | */ |
| 105 | 105 | protected function getParamsToInject(array $parameters) |
| 106 | 106 | { |
| 107 | - return array_map(function ($parameter) |
|
| 107 | + return array_map(function($parameter) |
|
| 108 | 108 | { |
| 109 | 109 | return $this->grabParameter($parameter); |
| 110 | 110 | |
@@ -9,77 +9,77 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class AuthServiceProvider extends ServiceProvider { |
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * Boot up the package. |
|
| 14 | - * |
|
| 15 | - * @return void |
|
| 16 | - */ |
|
| 17 | - public function boot() |
|
| 18 | - { |
|
| 19 | - $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'auth'); |
|
| 20 | - |
|
| 21 | - $this->publishes([__DIR__.'/../config/_auth.php' => config_path('_auth.php')], 'config'); |
|
| 22 | - |
|
| 23 | - $this->publishes([__DIR__.'/../database/migrations/' => database_path('migrations')], 'migration'); |
|
| 24 | - |
|
| 25 | - $this->publishes([__DIR__.'/../resources/lang/' => base_path('resources/lang/vendor/auth')], 'lang'); |
|
| 26 | - |
|
| 27 | - include __DIR__.'/Http/routes.php'; |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * Register the service provider. |
|
| 32 | - * |
|
| 33 | - * @return void |
|
| 34 | - */ |
|
| 35 | - public function register() |
|
| 36 | - { |
|
| 37 | - $this->mergeConfigFrom(__DIR__.'/../config/_auth.php', 'auth'); |
|
| 38 | - |
|
| 39 | - $this->registerUserRepository(); |
|
| 40 | - |
|
| 41 | - $this->registerThrottler(); |
|
| 42 | - |
|
| 43 | - $this->registerDispatcher(); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * Register the user repository. |
|
| 48 | - * |
|
| 49 | - * @author Andrea Marco Sartori |
|
| 50 | - * @return void |
|
| 51 | - */ |
|
| 52 | - private function registerUserRepository() |
|
| 53 | - { |
|
| 54 | - $userRepo = 'Cerbero\Auth\Repositories\EloquentUserRepository'; |
|
| 55 | - |
|
| 56 | - $this->app->bind('Cerbero\Auth\Repositories\UserRepositoryInterface', $userRepo); |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * Register the login throttling service. |
|
| 61 | - * |
|
| 62 | - * @author Andrea Marco Sartori |
|
| 63 | - * @return void |
|
| 64 | - */ |
|
| 65 | - private function registerThrottler() |
|
| 66 | - { |
|
| 67 | - $throttler = 'Cerbero\Auth\Services\Throttling\CachingThrottler'; |
|
| 68 | - |
|
| 69 | - $this->app->bind('Cerbero\Auth\Services\Throttling\ThrottlerInterface', $throttler); |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * Register the dispatcher service. |
|
| 74 | - * |
|
| 75 | - * @author Andrea Marco Sartori |
|
| 76 | - * @return void |
|
| 77 | - */ |
|
| 78 | - private function registerDispatcher() |
|
| 79 | - { |
|
| 80 | - $dispatcher = 'Cerbero\Auth\Services\Dispatcher\MarshalDispatcher'; |
|
| 81 | - |
|
| 82 | - $this->app->bind('Cerbero\Auth\Services\Dispatcher\DispatcherInterface', $dispatcher); |
|
| 83 | - } |
|
| 12 | + /** |
|
| 13 | + * Boot up the package. |
|
| 14 | + * |
|
| 15 | + * @return void |
|
| 16 | + */ |
|
| 17 | + public function boot() |
|
| 18 | + { |
|
| 19 | + $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'auth'); |
|
| 20 | + |
|
| 21 | + $this->publishes([__DIR__.'/../config/_auth.php' => config_path('_auth.php')], 'config'); |
|
| 22 | + |
|
| 23 | + $this->publishes([__DIR__.'/../database/migrations/' => database_path('migrations')], 'migration'); |
|
| 24 | + |
|
| 25 | + $this->publishes([__DIR__.'/../resources/lang/' => base_path('resources/lang/vendor/auth')], 'lang'); |
|
| 26 | + |
|
| 27 | + include __DIR__.'/Http/routes.php'; |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * Register the service provider. |
|
| 32 | + * |
|
| 33 | + * @return void |
|
| 34 | + */ |
|
| 35 | + public function register() |
|
| 36 | + { |
|
| 37 | + $this->mergeConfigFrom(__DIR__.'/../config/_auth.php', 'auth'); |
|
| 38 | + |
|
| 39 | + $this->registerUserRepository(); |
|
| 40 | + |
|
| 41 | + $this->registerThrottler(); |
|
| 42 | + |
|
| 43 | + $this->registerDispatcher(); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * Register the user repository. |
|
| 48 | + * |
|
| 49 | + * @author Andrea Marco Sartori |
|
| 50 | + * @return void |
|
| 51 | + */ |
|
| 52 | + private function registerUserRepository() |
|
| 53 | + { |
|
| 54 | + $userRepo = 'Cerbero\Auth\Repositories\EloquentUserRepository'; |
|
| 55 | + |
|
| 56 | + $this->app->bind('Cerbero\Auth\Repositories\UserRepositoryInterface', $userRepo); |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * Register the login throttling service. |
|
| 61 | + * |
|
| 62 | + * @author Andrea Marco Sartori |
|
| 63 | + * @return void |
|
| 64 | + */ |
|
| 65 | + private function registerThrottler() |
|
| 66 | + { |
|
| 67 | + $throttler = 'Cerbero\Auth\Services\Throttling\CachingThrottler'; |
|
| 68 | + |
|
| 69 | + $this->app->bind('Cerbero\Auth\Services\Throttling\ThrottlerInterface', $throttler); |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * Register the dispatcher service. |
|
| 74 | + * |
|
| 75 | + * @author Andrea Marco Sartori |
|
| 76 | + * @return void |
|
| 77 | + */ |
|
| 78 | + private function registerDispatcher() |
|
| 79 | + { |
|
| 80 | + $dispatcher = 'Cerbero\Auth\Services\Dispatcher\MarshalDispatcher'; |
|
| 81 | + |
|
| 82 | + $this->app->bind('Cerbero\Auth\Services\Dispatcher\DispatcherInterface', $dispatcher); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | 85 | } |