LaravelModelHashidsServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 62
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 40 2
A register() 0 12 1
1
<?php
2
3
/*
4
 * This file is part of Laravel Model Hashids.
5
 *
6
 * (c) Javier Cabello <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Jaacu\LaravelModelHashids;
13
14
use Illuminate\Support\ServiceProvider;
15
use Illuminate\Database\Schema\Blueprint;
16
use Vinkla\Hashids\HashidsServiceProvider;
17
18
class LaravelModelHashidsServiceProvider extends ServiceProvider
19
{
20
    /**
21
     * Bootstrap the application services.
22
     */
23
    public function boot()
24
    {
25
        /*
26
         * Optional methods to load your package assets
27
         */
28
        // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'laravel-model-hashids');
29
        // $this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-model-hashids');
30
        // $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
31
        // $this->loadRoutesFrom(__DIR__.'/routes.php');
32
33
        $this->app->register(HashidsServiceProvider::class);
34
35
        Blueprint::macro('hashid', function () {
36
            return $this->string('hash_id')->unique()->nullable()->index();
0 ignored issues
show
Bug introduced by
The method string() does not seem to exist on object<Jaacu\LaravelMode...HashidsServiceProvider>.

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
        });
38
39
        if ($this->app->runningInConsole()) {
40
            $this->publishes([
41
                __DIR__.'/../config/config.php' => config_path('hashids.php'),
42
            ], 'config');
43
44
            // Publishing the views.
45
            /*$this->publishes([
46
                __DIR__.'/../resources/views' => resource_path('views/vendor/laravel-model-hashids'),
47
            ], 'views');*/
48
49
            // Publishing assets.
50
            /*$this->publishes([
51
                __DIR__.'/../resources/assets' => public_path('vendor/laravel-model-hashids'),
52
            ], 'assets');*/
53
54
            // Publishing the translation files.
55
            /*$this->publishes([
56
                __DIR__.'/../resour/var/www/test.io/public/proyect-prueba/packages/jaacu/laravel-model-hashids/build/coverage/index.htmlces/lang' => resource_path('lang/vendor/laravel-model-hashids'),
57
            ], 'lang');*/
58
59
            // Registering package commands.
60
            // $this->commands([]);
61
        }
62
    }
63
64
    /**
65
     * Register the application services.
66
     */
67
    public function register()
68
    {
69
        // Automatically apply the package configuration
70
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'hashids');
71
72
        // $this->app['config']->set('hashids', require __DIR__.'/../config/config.php');
73
74
        // Register the main class to use with the facade
75
        // $this->app->singleton('laravel-model-hashids', function () {
76
        //     return new LaravelModelHashids;
77
        // });
78
    }
79
}
80