Help for integrating the Laravel package
Forum rules: Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#5553 by HimanshuBhandari
26 Jan 2018, 04:56
aimeos wrote:Can you please post your ./app/Providers/AuthServiceProvider.php file?

Code: Select all<?php

namespace App\Providers;

use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;

class AuthServiceProvider extends ServiceProvider
{
    /**
     * The policy mappings for the application.
     *
     * @var array
     */
    protected $policies = [
        'App\Model' => 'App\Policies\ModelPolicy',
    ];

    /**
     * Register any authentication / authorization services.
     *
     * @return void
     */
    public function boot()
    {
        $this->registerPolicies();

        Gate::define('admin', function($user, $class, $roles) {
            return app( '\Aimeos\Shop\Base\Support' )->checkGroup( $user->id, $roles );
        });
    }
}

aimeos wrote:Also can you post the HTTP request and response which fails with HTTP error 419?

I started my local server on windows 10 with:
Code: Select allphp -S 127.0.0.1:8000 -t .\public\


and performing all actions on
Code: Select allhttp://127.0.0.1:8000/admin


When I clicked on Vouchers tab:
Code: Select allRequest URL:http://127.0.0.1:8000/admin/default/jsonadm
Request Method:OPTIONS
Status Code:401 Unauthorized
Remote Address:127.0.0.1:8000
Referrer Policy:no-referrer-when-downgrade
Response Headers
view source
Cache-Control:no-cache, private
Connection:close
Content-Type:application/json
Date:Fri, 26 Jan 2018 04:47:50 GMT
Host:127.0.0.1:8000
Set-Cookie:XSRF-TOKEN=eyJpdiI6ImZPUDRiZ21OM1RkMlp0VmROSlJaTEE9PSIsInZhbHVlIjoiNTBiSmFKa0UyUTN3cW51eUFiUzM4XC9YcWNNMGpQNG1CdmV0Y0d2UW0zVElFcGNROEU4ZTduOTlDOENXOTcyVkNxRHZBMjZWUzlaTEk4XC9VUEsrVHo3Zz09IiwibWFjIjoiYTNlNDk3Mjc2NGExZDg0ZWFhYjY2MDMwYzhiYTM4ZWU5ZTBjNTIxNTFhMWFmMWRhZGMyMzEwYWM3NjdlYmQ1MyJ9; expires=Fri, 26-Jan-2018 06:47:50 GMT; Max-Age=7200; path=/
Set-Cookie:laravel_session=eyJpdiI6IldKenhyUFhoTjBqWW9cLzM2M1JsMXdRPT0iLCJ2YWx1ZSI6IkkyWjhQNnVcL3UwczQzQ3NIQTR6Z0JZeXk2QmxcL0RqUDhwZXFEU1J5c1lFZTJzSFBoRFdIcnVKYm80SU56Y29raUpUc21HXC9VZVZienkxNGdnOE1jS0RnPT0iLCJtYWMiOiJjMmQ4M2Y4YmYzOGJmY2E5NTliYTU0MzFjODQ1Mzk0OGEwZDgyZmE4ZGVmNDViNTBiMjMxZWM3MDliYmFiYzY2In0%3D; expires=Fri, 26-Jan-2018 06:47:50 GMT; Max-Age=7200; path=/; HttpOnly
X-Powered-By:PHP/7.0.23


After that I clicked on currencies tab and I was logged out and now if I click on any tab I need to log in again.
---------------------------------------

When I logged in again and clicked on Currency > choose currency > enable > Save > After 3rd click(as I was not redirecting anywhere) I got following exception:

Code: Select allRequest URL:http://127.0.0.1:8000/admin/default/jsonadm
Request Method:OPTIONS
Status Code:401 Unauthorized
Remote Address:127.0.0.1:8000
Referrer Policy:no-referrer-when-downgrade
Response Headers
view source
Cache-Control:no-cache, private
Connection:close
Content-Type:application/json
Date:Fri, 26 Jan 2018 04:50:47 GMT
Host:127.0.0.1:8000
Set-Cookie:XSRF-TOKEN=eyJpdiI6IkxXXC9ZZnB3WTBFYzJNODV2OTJNbE93PT0iLCJ2YWx1ZSI6IkY3XC80ampGNzZTeUI1TzBZVzdBNFRNRks1Yjc1R3ZUclZFejZ1TjNcL1luaHVBWmlTZktBbXJvQklZTStQVjVjWDZCdEp2Y3hxV2tRYzBSb3c4TUNZbHc9PSIsIm1hYyI6IjA4N2YwZGY0YTc2NDU1ZWI2NDg3YjI0YWMxNTcwMmRiZmY1MWVkYWI3ZDgwZmRmYjJkNmUxZjAyZGRiY2I1YjkifQ%3D%3D; expires=Fri, 26-Jan-2018 06:50:47 GMT; Max-Age=7200; path=/
Set-Cookie:laravel_session=eyJpdiI6IlFyNlNIV09OVUoyVkhiYWdMNUNaSXc9PSIsInZhbHVlIjoiOHNMUHFYSW8xQWN0N2twb3J3Y3pNZmpzVFV6M1dKUFY4cWNVZ2M1MlJrZzZacURxQWhadllibHNEQWhtV3FiRXQ1bjdpdVFKbDJHbmZoSjlURDdRd2c9PSIsIm1hYyI6IjU0ZDVlNmVkZTc0NjA2ZDI5Yzg2NzdiNTA0YmM4OWVhZGExYmM1Yzk1YjVmOTY4YzdhNjkyZTkwM2JjYzM5NjUifQ%3D%3D; expires=Fri, 26-Jan-2018 06:50:47 GMT; Max-Age=7200; path=/; HttpOnly
X-Powered-By:PHP/7.0.23
Request Headers
view source
Accept:application/json, text/javascript, */*; q=0.01
Accept-Encoding:gzip, deflate, br
Accept-Language:en-US,en;q=0.9,hi;q=0.8
Connection:keep-alive
Cookie:remember_web_59ba36addc2b2f9401580f014c7f58ea4e30989d=eyJpdiI6ImNtTHlna0tcL1ZkNDM3U205ZkpLOUFRPT0iLCJ2YWx1ZSI6ImNqS2NpVnhXMlFtMWp1b25JQmk4c2tkU3lkQWhOVUFlbyszVGJmWFNSdytLMUpOeDkwQUNCaUorcHpob0VrWVp2bEc3ZU9NZlFIUGdrMkxxMDZWWkc1VWJsT2JJM3RFXC9CR2h5aCtCbHZoXC9sT1dsZlZYeit2VG5cL2dmblpMQ25pdEp0UXNvdlBiSjU4TTdGbkl4TWIwTmVYSEtEaG5XdmVJWVlhenIyRTFEZGROQm9VdlZPNktvcDNGMmJGbUdqNiIsIm1hYyI6IjIxNGMyNmM4MWFjYzdiZWQ2ZTk0MjZlNGQ0MTM4YTQ4MDRhZTIxN2JhNThkOTk0ZTQ0MmU1NjA4ZjVjYThhMzIifQ%3D%3D; XSRF-TOKEN=eyJpdiI6ImFMcm1QakRHWUJQcGZMQXJ2V01cL3RBPT0iLCJ2YWx1ZSI6IjlJbm9oSE5DdTZ2OTNDR1wveFRiRFwvTjFQMzZsTzdYa3BOOWU0WDlVS1h5cUJsWFQrVitLNVRtR1d6eGpnaXpqbU9ub1RuR3lWc0szVzNuOHVyUldZWEE9PSIsIm1hYyI6IjIzNDgzNDliMWI1ZGEwMDQwY2Q4MWUzNWRjOGQ1ZWI3YzI3N2RjMjAwNmY2ZWM0NzZkNGM3ZTQyZTc1MjAzYWEifQ%3D%3D; laravel_session=eyJpdiI6ImVZY0pOMVFNSjZWMW9BdWZcL2xtRlwvdz09IiwidmFsdWUiOiJZeVpoMlJrTDV5VDZRcFwvNEZcL1JWSE5hcTJ4NnlqXC9JTGlkdTlDUUlYak8xbEdpemNoYUk4RHk1M015VktDNFdhb3lNeXFHd2Jwa2JZWm1jR0JlRlhrUT09IiwibWFjIjoiNzMwM2JjYjQ1MTg5YjgwZmZmMzQyNDE1ZGNkODNmYTNkYjlkNmU3NGQzZmMxOTAxZGE4MzgzNjdhNzBlNDZmMCJ9
Host:127.0.0.1:8000
Origin:http://127.0.0.1:8000
Referer:http://127.0.0.1:8000/admin/default/jqadm/get/locale/currency/AFN?lang=en
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
X-Requested-With:XMLHttpRequest
#5555 by HimanshuBhandari
26 Jan 2018, 05:17
Now if I start server with
Code: Select allphp artisan serve
and browse it at
Code: Select allhttp://localhost:8000/admin
EVERYTHING works fine without any error(at least what I got broken with 127.0.0.1). :roll:

But Can this be also an issue? I was following docs properly so didn't try this earlier.

However Add site button is still not available in Sites menu, but with github link setup I got that. But why it got disappeared in Laravel setup steps?
Also after save there should be a success message or redirection for better experience, but I know all this will come with time as Aimeos grows so no worries.

Thanks a lot for all help.
#5558 by aimeos
26 Jan 2018, 09:29
That's really strange, especially as "./artisan serve" doesn't seem to do much more than "php -S 127.0.0.1:8000 -t public". We will update the docs to suggest using "artisan serve" instead of PHP web server directly. Maybe that's important for Windows environments.

In the new 2018.01 version, success messaged are already displayed after saving :-)
#5561 by aimeos
26 Jan 2018, 09:59
HimanshuBhandari wrote:However Add site button is still not available in Sites menu, but with github link setup I got that. But why it got disappeared in Laravel setup steps?


The button to add new sites is the "+" icon right of "Config" in the table header. Please remember that you need to execute
Code: Select all./artisan aimeos:setup <sitecode>

on the console nevertheless to add the required types and other data!
Attachments
admin-locale-site.png
admin-locale-site.png (134.72 KiB) Viewed 351 times
#5587 by aimeos
28 Jan 2018, 17:56
Can you post a screenshot of the Locale -> Site list view from your admin interface?
I can't belief that the plus button in the list header (right) isn't there!
#5607 by aimeos
30 Jan 2018, 18:16
Can you have a look into the web inspector of your browser if the icon is still there and some CSS hides it? Seems to me that there are CSS rules that interfere with the Aimeos CSS.