Issues (71)

src/MongicommerceServiceProvider.php (9 issues)

1
<?php
2
3
namespace Mongi\Mongicommerce;
4
5
use Illuminate\Routing\Router;
6
use Illuminate\Support\Facades\File;
7
use Illuminate\Support\Facades\View;
8
use Illuminate\Support\Facades\Blade;
9
use Illuminate\Foundation\Http\Kernel;
10
use Illuminate\Support\Facades\Schema;
11
use Illuminate\Support\ServiceProvider;
12
use Mongi\Mongicommerce\Models\Category;
13
use Mongi\Mongicommerce\Libraries\Template;
14
use Mongi\Mongicommerce\Models\AdminSetting;
15
use Mongi\Mongicommerce\Console\UpdatePackage;
16
use Mongi\Mongicommerce\Console\InstallPackage;
17
use Mongi\Mongicommerce\Http\Middleware\AdminMiddleware;
18
19
class MongicommerceServiceProvider extends ServiceProvider
20
{
21
    /**
22
     * Bootstrap the application services.
23
     */
24
    public function boot(Router $router, Kernel $kernel)
0 ignored issues
show
The parameter $kernel is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

24
    public function boot(Router $router, /** @scrutinizer ignore-unused */ Kernel $kernel)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
25
    {
26
27
        Blade::directive('money', function ($amount) {
28
            #return $fmt->formatCurrency($amount,"EUR");
29
            /*return "<?= $fmt->formatCurrency($amount,'EUR'); ?>";*/
30
            return "<?= abs($amount) > 1000 ? '€ ' .number_format($amount, 0, ',', '.') : '€ ' . number_format($amount, 2, ',', '.') ?>";
31
        });
32
        /*
33
         * Optional methods to load your package assets
34
         */
35
        // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'mongicommerce');
36
        $this->loadViewsFrom(__DIR__ . '/../resources/views', 'mongicommerce');
0 ignored issues
show
The method loadViewsFrom() does not exist on Mongi\Mongicommerce\MongicommerceServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

36
        $this->/** @scrutinizer ignore-call */ 
37
               loadViewsFrom(__DIR__ . '/../resources/views', 'mongicommerce');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
37
        $this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
0 ignored issues
show
The method loadMigrationsFrom() does not exist on Mongi\Mongicommerce\MongicommerceServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

37
        $this->/** @scrutinizer ignore-call */ 
38
               loadMigrationsFrom(__DIR__ . '/../database/migrations');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
38
        $this->loadRoutesFrom(__DIR__ . '/routes.php');
0 ignored issues
show
The method loadRoutesFrom() does not exist on Mongi\Mongicommerce\MongicommerceServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

38
        $this->/** @scrutinizer ignore-call */ 
39
               loadRoutesFrom(__DIR__ . '/routes.php');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
39
40
        if (Schema::hasTable('admin_settings')) {
41
            //inject global information into views
42
            View::share('mongicommerce', AdminSetting::first());
43
        }
44
45
        if (Schema::hasTable('categories')) {
46
            //inject global information into views
47
            View::share('categories', Template::getCategoryTree());
48
        }
49
50
        #$router->middleware(AdminMiddleware::class);
51
        $router->aliasMiddleware('admin',AdminMiddleware::class);
52
53
54
        if ($this->app->runningInConsole()) {
0 ignored issues
show
The method runningInConsole() does not exist on Tests\Laravel\App. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

54
        if ($this->app->/** @scrutinizer ignore-call */ runningInConsole()) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
55
56
57
            // Publishing the config file.
58
            $this->publishes([
0 ignored issues
show
The method publishes() does not exist on Mongi\Mongicommerce\MongicommerceServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

58
            $this->/** @scrutinizer ignore-call */ 
59
                   publishes([

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
59
                __DIR__ . '/../config/config.php' => config_path('mongicommerce.php'),
60
            ], 'config');
61
62
63
            // Publishing the views.
64
            $this->publishes([
65
                __DIR__ . '/../resources/views/shop' => resource_path('/views/mongicommerce'),
66
            ], 'views');
67
68
69
            // Publishing assets.
70
            $this->publishes([
71
                __DIR__ . '/../resources/assets' => public_path('/mongicommerce/template'),
72
            ], 'assets');
73
74
            // Registering package commands.
75
            $this->commands([
0 ignored issues
show
The method commands() does not exist on Mongi\Mongicommerce\MongicommerceServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

75
            $this->/** @scrutinizer ignore-call */ 
76
                   commands([

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
76
                InstallPackage::class,
77
                UpdatePackage::class
78
            ]);
79
80
            // Publishing the translation files.
81
            /*$this->publishes([
82
                __DIR__.'/../resources/lang' => resource_path('lang/vendor/mongicommerce'),
83
            ], 'lang');*/
84
        }
85
    }
86
87
    /**
88
     * Register the application services.
89
     */
90
    public function register()
91
    {
92
        // Automatically apply the package configuration
93
        $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'mongicommerce');
0 ignored issues
show
The method mergeConfigFrom() does not exist on Mongi\Mongicommerce\MongicommerceServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

93
        $this->/** @scrutinizer ignore-call */ 
94
               mergeConfigFrom(__DIR__ . '/../config/config.php', 'mongicommerce');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
94
95
        // Register the main class to use with the facade
96
        $this->app->singleton('mongicommerce', function () {
0 ignored issues
show
The method singleton() does not exist on Tests\Laravel\App. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

96
        $this->app->/** @scrutinizer ignore-call */ 
97
                    singleton('mongicommerce', function () {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
97
            return new Mongicommerce;
98
        });
99
    }
100
}
101