aimeos / aimeos-laravel

Laravel ecommerce package for ultra fast online shops, scalable marketplaces, complex B2B applications and #gigacommerce
https://aimeos.org/Laravel
MIT License
7.1k stars 1.04k forks source link

it is redirecting to laravel's own admin panel ? #131

Closed ZaheerAbbasAghani closed 7 years ago

ZaheerAbbasAghani commented 7 years ago

Is aimeos provide it's own dashboard ? and where to add below code ?

public function boot() { // Keep the lines before

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

}

aimeos commented 7 years ago

Please add it to the app/Providers/AuthServiceProvider.php file in your Laravel installation

ZaheerAbbasAghani commented 7 years ago

added but now showing below error ? I had already added ShopServiceProvider class in config/app.php

[Symfony\Component\Debug\Exception\FatalThrowableError] Class 'Aimeos\Shop\ShopServiceProvider' not found

aimeos commented 7 years ago

Did you've followed the docs how to set up the admin interface? https://github.com/aimeos/aimeos-laravel#admin

For Laravel 5.3/5.4, you have to execute ./artisan make:auth to add authentication to Laravel. Afterwards, you can add the code listed in the Aimeos docs.

ZaheerAbbasAghani commented 7 years ago

i read the docs and i used php artisan make:auth too but it showing below error

[Symfony\Component\Debug\Exception\FatalThrowableError] Class 'Aimeos\Shop\ShopServiceProvider' not found

aimeos commented 7 years ago

You propably forgot to add the service provider to your config/app.php file:

Next, the Aimeos provider class must be added to the providers array of the config/app.php file so the application and Laravel command task will work:

return array(
    'providers' => array(
        ...
        Aimeos\Shop\ShopServiceProvider::class,
    ),
);
ZaheerAbbasAghani commented 7 years ago

capture1

aimeos commented 7 years ago

You have to add it at the end of the array so the Laravel AuthServiceProvider is available

ZaheerAbbasAghani commented 7 years ago

Same error... capture2

ZaheerAbbasAghani commented 7 years ago

capture11

ZaheerAbbasAghani commented 7 years ago

I had added with laravel providers or i have to create new array like return array( 'providers' => array( ... Aimeos\Shop\ShopServiceProvider::class, ), );

in config/app.php

capture11

aimeos commented 7 years ago

Did you add "aimeos/aimeos-laravel" to your composer.json file run composer update? Can you post your composer.json file? What does composer show -i displays?

ZaheerAbbasAghani commented 7 years ago

{ "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "type": "project", "require": { "php": ">=5.6.4", "laravel/framework": "5.4.", "laravel/tinker": "~1.0" }, "require-dev": { "fzaninotto/faker": "~1.4", "mockery/mockery": "0.9.", "phpunit/phpunit": "~5.7" }, "autoload": { "classmap": [ "database" ], "psr-4": { "App\": "app/" } }, "autoload-dev": { "psr-4": { "Tests\": "tests/" } }, "scripts": { "post-root-package-install": [ "php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "php artisan key:generate" ], "post-install-cmd": [ "Illuminate\Foundation\ComposerScripts::postInstall", "php artisan optimize" ], "post-update-cmd": [ "Illuminate\Foundation\ComposerScripts::postUpdate", "php artisan optimize" ] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true },

"prefer-stable": true, "minimum-stability": "dev", "require": { "aimeos/aimeos-laravel": "~2017.07"

},
"scripts": {

    "post-update-cmd": [
        "php artisan vendor:publish --tag=public --force",
        "php artisan vendor:publish",
        "php artisan migrate"

    ]
}

}

ZaheerAbbasAghani commented 7 years ago

Composer show -i displaying

$ composer show -i Key require is a duplicate in ./composer.json at line 57 PHP temp directory (C:\Users\Zaheer\AppData\Local\Temp) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages. dnoegel/php-xdg-base-dir 0.1 implementation of xdg base directory specification for php doctrine/inflector v1.1.0 Common String Manipulations with regard to casing and singul... doctrine/instantiator 1.0.5 A small, lightweight utility to instantiate objects in PHP w... erusev/parsedown 1.6.3 Parser for Markdown. fzaninotto/faker v1.6.0 Faker is a PHP library that generates fake data for you. hamcrest/hamcrest-php v1.2.2 This is the PHP port of Hamcrest Matchers jakub-onderka/php-console-color 0.1 jakub-onderka/php-console-highlighter v0.3.2 laravel/framework v5.4.28 The Laravel Framework. laravel/tinker v1.0.1 Powerful REPL for the Laravel framework. league/flysystem 1.0.40 Filesystem abstraction: Many filesystems, one API. mockery/mockery 0.9.9 Mockery is a simple yet flexible PHP mock object framework f... monolog/monolog 1.23.0 Sends your logs to files, sockets, inboxes, databases and va... mtdowling/cron-expression v1.2.0 CRON for PHP: Calculate the next or previous run date and de... myclabs/deep-copy 1.6.1 Create deep copies (clones) of your objects nesbot/carbon 1.22.1 A simple API extension for DateTime. nikic/php-parser v3.0.6 A PHP parser written in PHP paragonie/random_compat v2.0.10 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7 phpdocumentor/reflection-common 1.0 Common reflection classes used by phpdocumentor to reflect t... phpdocumentor/reflection-docblock 3.2.0 With this component, a library can provide support for annot... phpdocumentor/type-resolver 0.4.0 phpspec/prophecy v1.7.0 Highly opinionated mocking framework for PHP 5.3+ phpunit/php-code-coverage 4.0.8 Library that provides collection, processing, and rendering ... phpunit/php-file-iterator 1.4.2 FilterIterator implementation that filters files based on a ... phpunit/php-text-template 1.2.1 Simple template engine. phpunit/php-timer 1.0.9 Utility class for timing phpunit/php-token-stream 1.4.11 Wrapper around PHP's tokenizer extension. phpunit/phpunit 5.7.21 The PHP Unit Testing framework. phpunit/phpunit-mock-objects 3.4.4 Mock Object library for PHPUnit psr/log 1.0.2 Common interface for logging libraries psy/psysh v0.8.9 An interactive shell for modern PHP. ramsey/uuid 3.6.1 Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC... sebastian/code-unit-reverse-lookup 1.0.1 Looks up which function or method a line of code belongs to sebastian/comparator 1.2.4 Provides the functionality to compare PHP values for equality sebastian/diff 1.4.3 Diff implementation sebastian/environment 2.0.0 Provides functionality to handle HHVM/PHP environments sebastian/exporter 2.0.0 Provides the functionality to export PHP variables for visua... sebastian/global-state 1.1.1 Snapshotting of global state sebastian/object-enumerator 2.0.1 Traverses array structures and object graphs to enumerate al... sebastian/recursion-context 2.0.0 Provides functionality to recursively process PHP variables sebastian/resource-operations 1.0.0 Provides a list of PHP built-in functions that operate on re... sebastian/version 2.0.1 Library that helps with managing the version number of Git-h... swiftmailer/swiftmailer v5.4.8 Swiftmailer, free feature-rich PHP mailer symfony/console v3.3.5 Symfony Console Component symfony/css-selector v3.3.5 Symfony CssSelector Component symfony/debug v3.3.5 Symfony Debug Component symfony/event-dispatcher v3.3.5 Symfony EventDispatcher Component symfony/finder v3.3.5 Symfony Finder Component symfony/http-foundation v3.3.5 Symfony HttpFoundation Component symfony/http-kernel v3.3.5 Symfony HttpKernel Component symfony/polyfill-mbstring v1.4.0 Symfony polyfill for the Mbstring extension symfony/process v3.3.5 Symfony Process Component symfony/routing v3.3.5 Symfony Routing Component symfony/translation v3.3.5 Symfony Translation Component symfony/var-dumper v3.3.5 Symfony mechanism for exploring and dumping PHP variables symfony/yaml v3.3.5 Symfony Yaml Component tijsverkoyen/css-to-inline-styles 2.2.0 CssToInlineStyles is a class that enables you to convert HTM... vlucas/phpdotenv v2.4.0 Loads environment variables from .env to getenv(), `$_EN... webmozart/assert 1.2.0 Assertions to validate method input/output with nice error m...

aimeos commented 7 years ago

Your composer.json is wrong. You need to merge the "aimeos/aimeos-laravel" and the script lines into the existing JSON nodes and not create new ones for require and scripts

ZaheerAbbasAghani commented 7 years ago

how to merge ?

"prefer-stable": true, "minimum-stability": "dev", "require": { "aimeos/aimeos-laravel": "~2017.07"}, "scripts": {

    "post-update-cmd": [
        "php artisan vendor:publish --tag=public --force",
        "php artisan vendor:publish",
        "php artisan migrate"

    ]
}
ZaheerAbbasAghani commented 7 years ago

Same error i merged too .

{ "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "type": "project", "require": { "php": ">=5.6.4", "laravel/framework": "5.4.", "laravel/tinker": "~1.0", "aimeos/aimeos-laravel": "~2017.07" }, "require-dev": { "fzaninotto/faker": "~1.4", "mockery/mockery": "0.9.", "phpunit/phpunit": "~5.7" }, "autoload": { "classmap": [ "database" ], "psr-4": { "App\": "app/" } }, "autoload-dev": { "psr-4": { "Tests\": "tests/" } }, "scripts": { "post-root-package-install": [ "php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "php artisan key:generate" ], "post-install-cmd": [ "Illuminate\Foundation\ComposerScripts::postInstall", "php artisan optimize" ], "post-update-cmd": [ "Illuminate\Foundation\ComposerScripts::postUpdate", "php artisan optimize", "php artisan vendor:publish --tag=public --force", "php artisan vendor:publish", "php artisan migrate", ] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true },

}

aimeos commented 7 years ago
{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "prefer-stable": true,
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.6.4",
        "laravel/framework": "5.4.",
        "laravel/tinker": "~1.0",
        "aimeos/aimeos-laravel": "~2017.07"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.",
        "phpunit/phpunit": "~5.7"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }
    },
    "scripts": {
        "post-root-package-install": [
            "php -r "file_exists('.env') || copy('.env.example', '.env');""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\Foundation\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "php artisan vendor:publish --tag=public --force",
            "php artisan vendor:publish",
            "php artisan migrate",
            "Illuminate\Foundation\ComposerScripts::postUpdate",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    }
}
aimeos commented 7 years ago

Remove Aimeos\Shop\ShopServiceProvider::class, from config/app.php again and run composer update. Afterwards, re-add Aimeos\Shop\ShopServiceProvider::class, and continue with the instructions from the docs.

ZaheerAbbasAghani commented 7 years ago

Now getting below error (1/1) FatalThrowableError Class 'App\Providers\Gate' not found

aimeos commented 7 years ago

Please restart from scratch using the correct composer.json file and follow the documentation step by step. Then it should work as expected.

ZaheerAbbasAghani commented 7 years ago

Ok starting again

ZaheerAbbasAghani commented 7 years ago

It is working now the mistake were i was adding this code in AppServiceProvider.php instead of AuthServiceProvider.php

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

Thanks for your help

Altaibaatar commented 6 years ago

I made a same mistake like this.

It is working now the mistake were i was adding this code in AppServiceProvider.php instead of AuthServiceProvider.php

It really helped me, thank you!

sigdaahamed commented 11 months ago

Class "Aimeos\Shop\Aimeos\Shop\ShopServiceProvider" not found

aimeos commented 11 months ago

Do you have a stack trace?