56 lines
1.3 KiB
PHP
56 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Bo\Auth;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class LoginController extends Controller
|
|
{
|
|
use AuthenticatesUsers;
|
|
|
|
/**
|
|
* Create a new controller instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
$this->middleware('guest:backend')->except('logout');
|
|
}
|
|
|
|
/**
|
|
* Get the guard to be used during authentication.
|
|
*
|
|
* @return \Illuminate\Contracts\Auth\StatefulGuard
|
|
*/
|
|
protected function guard()
|
|
{
|
|
return Auth::guard('backend');
|
|
}
|
|
|
|
/**
|
|
* Show the application's login form.
|
|
*
|
|
* @return \Illuminate\View\View
|
|
*/
|
|
public function showLoginForm()
|
|
{
|
|
return view('back::auth.login');
|
|
}
|
|
|
|
/**
|
|
* Where to redirect users after login.
|
|
* @return string
|
|
*/
|
|
protected function redirectTo(): string
|
|
{
|
|
$intendedUrl = response()->redirectToIntended()->getTargetUrl();
|
|
$intendedRequest = Request::create($intendedUrl);
|
|
return \strpos($intendedRequest->path(), '/ bo') === 0 ?
|
|
response()->redirectToIntended()->getTargetUrl() :
|
|
\route('bo.dashboard');
|
|
}
|
|
}
|