1 | <?php |
||||
2 | |||||
3 | /** |
||||
4 | * @license MIT, http://opensource.org/licenses/MIT |
||||
5 | * @copyright Aimeos (aimeos.org), 2014-2023 |
||||
6 | */ |
||||
7 | |||||
8 | |||||
9 | namespace Aimeos\Shop\Controller; |
||||
10 | |||||
11 | use Illuminate\Routing\Controller; |
||||
12 | use Illuminate\Support\Facades\Auth; |
||||
13 | use Illuminate\Support\Facades\Request; |
||||
14 | use Illuminate\Support\Facades\Route; |
||||
15 | use Illuminate\Support\Facades\View; |
||||
16 | use Illuminate\Foundation\Auth\Access\AuthorizesRequests; |
||||
17 | |||||
18 | |||||
19 | /** |
||||
20 | * Controller providing the administration interface |
||||
21 | */ |
||||
22 | class AdminController extends Controller |
||||
23 | { |
||||
24 | use AuthorizesRequests; |
||||
25 | |||||
26 | |||||
27 | /** |
||||
28 | * Returns the initial HTML view for the admin interface. |
||||
29 | * |
||||
30 | * @param \Illuminate\Http\Request $request Laravel request object |
||||
31 | * @return \Illuminate\Contracts\View\View View for rendering the output |
||||
32 | */ |
||||
33 | public function indexAction( \Illuminate\Http\Request $request ) |
||||
34 | { |
||||
35 | if( Auth::check() === false |
||||
36 | || $request->user()->can( 'admin', [AdminController::class, config( 'shop.roles', ['admin', 'editor'] )] ) === false |
||||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
The call to
config() has too many arguments starting with array('admin', 'editor') .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.
Loading history...
|
|||||
37 | ) { |
||||
38 | return redirect()->guest( airoute( 'login', ['locale' => app()->getLocale()] ) ); |
||||
0 ignored issues
–
show
The method
getLocale() does not exist on Illuminate\Container\Container . Are you sure you never get this type here, but always one of the subclasses?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
39 | } |
||||
40 | |||||
41 | $context = app( 'aimeos.context' )->get( false ); |
||||
42 | $siteManager = \Aimeos\MShop::create( $context, 'locale/site' ); |
||||
43 | $siteId = current( array_reverse( explode( '.', trim( $request->user()->siteid, '.' ) ) ) ); |
||||
44 | $siteCode = ( $siteId ? $siteManager->get( $siteId )->getCode() : config( 'shop.mshop.locale.site', 'default' ) ); |
||||
45 | $locale = $request->user()->langid ?: config( 'app.locale', 'en' ); |
||||
46 | |||||
47 | $param = array( |
||||
48 | 'resource' => config( 'shop.panel', 'dashboard' ), |
||||
49 | 'site' => Route::input( 'site', Request::get( 'site', $siteCode ) ), |
||||
50 | 'locale' => Route::input( 'locale', Request::get( 'locale', $locale ) ) |
||||
51 | ); |
||||
52 | |||||
53 | return redirect()->route( 'aimeos_shop_jqadm_search', $param ); |
||||
54 | } |
||||
55 | } |
||||
56 |