This commit is contained in:
parent
945d3cb7e3
commit
f5a7004ea3
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
|
||||
class ShopAuthenticate extends Middleware
|
||||
|
|
@ -9,14 +11,29 @@ class ShopAuthenticate extends Middleware
|
|||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return string|null
|
||||
* @param Request $request
|
||||
*/
|
||||
protected function redirectTo($request)
|
||||
{
|
||||
if (! $request->expectsJson()) {
|
||||
// 后台
|
||||
if (!$request->expectsJson()) {
|
||||
return shop_route('login.index');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle an unauthenticated user.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param array $guards
|
||||
* @return void
|
||||
*
|
||||
* @throws AuthenticationException
|
||||
*/
|
||||
protected function unauthenticated($request, array $guards)
|
||||
{
|
||||
throw new AuthenticationException(
|
||||
trans('common.unauthenticated'), $guards, $this->redirectTo($request)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@
|
|||
*/
|
||||
|
||||
return [
|
||||
// action
|
||||
'error_required' => 'Please fill out the :name',
|
||||
'unauthenticated' => 'Please login first',
|
||||
'success' => 'Success',
|
||||
'created_success' => 'Created Successfully!',
|
||||
'deleted_success' => 'Deleted Successfully!',
|
||||
'restored_success' => 'Restore Successfully!',
|
||||
'updated_success' => 'Updated Successfully!',
|
||||
'created_success' => 'Created Successfully!',
|
||||
'get_success' => 'Get Successfully!',
|
||||
'error_required' => 'Please fill out the :name',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -10,6 +10,13 @@
|
|||
*/
|
||||
return [
|
||||
'error_required' => '请填写 :name',
|
||||
'unauthenticated' => '请先登录',
|
||||
'success' => '成功',
|
||||
'created_success' => '创建成功!',
|
||||
'deleted_success' => '删除成功!',
|
||||
'restored_success' => '恢复成功!',
|
||||
'updated_success' => '更新成功!',
|
||||
'get_success' => '获取成功!',
|
||||
];
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue