Passed
Branch master (328f34)
by Chubarov
04:39
created

SheduleEmailServiceProvider::publishesAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 16
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 22
ccs 16
cts 16
cp 1
rs 9.2
cc 1
eloc 15
nc 1
nop 0
crap 1
1
<?php
2
namespace agoalofalife\postman;
3
4
use Carbon\Carbon;
5
use Illuminate\Http\Request;
6
use Illuminate\Support\ServiceProvider;
7
use Illuminate\Support\Facades\Route;
8
9
/**
10
 * Class SheduleEmailServiceProvider
11
 *
12
 * @package Laravel\Passport
13
 */
14
class SheduleEmailServiceProvider extends ServiceProvider
15
{
16
17
    /**
18
     * Bootstrap the application services.
19
     *
20
     * @return void
21
     */
22 17
    public function boot()
23
    {
24 17
        $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
25 17
        $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'postman');
26
27 17
        $this->registerRoutes();
28 17
        $this->commands([
29 17
            Console\InstallCommand::class,
30
            Console\SeederCommand::class,
31
            Console\ParseCommand::class,
32
        ]);
33 17
        $this->loadViews();
34
35 17
        Request::macro('datePostman', function (Request $request) {
36 2
            $request-> date =  Carbon::parse($request->date)->toDateTimeString();
0 ignored issues
show
Bug introduced by
The property date does not seem to exist on Illuminate\Http\Request.
Loading history...
37 17
        });
38 17
        $this->mergeConfigFrom(__DIR__.'/../config/postman.php', 'postman');
39 17
        $this->publishesAll();
40 17
    }
41
42 17
    public function publishesAll() : void
43
    {
44 17
        $this->publishes([
45 17
            __DIR__.'/../database/migrations' => database_path('migrations'),
46 17
        ], 'postman-migration');
47
48 17
        $this->publishes([
49 17
            __DIR__.'/../config/postman.php' => config_path('postman.php'),
50 17
        ], 'postman-migration');
51
52 17
        $this->publishes([
53 17
            __DIR__.'/../resources/lang' => resource_path('lang/vendor/postman'),
54 17
        ], 'postman-migration');
55
56
57 17
        $this->publishes([
58 17
            __DIR__.'/../database/seeds' => database_path('seeds'),
59 17
        ], 'postman-migration');
60
61 17
        $this->publishes([
62 17
            __DIR__.'/../resources/assets/js/components' => base_path('resources/assets/js/components/postman'),
63 17
        ], 'postman-components');
64 17
    }
65
    /**
66
     * Register the postman routes.
67
     *
68
     * @return void
69
     */
70 17
    protected function registerRoutes()
71
    {
72 17
        Route::group([
73 17
            'prefix' => 'postman',
74
            'namespace' => 'agoalofalife\postman\Http\Controllers',
75
            'middleware' => 'web',
76 17
        ], function () {
0 ignored issues
show
Unused Code introduced by
The call to Illuminate\Support\Facades\Route::group() has too many arguments starting with function(...) { /* ... */ }. ( Ignorable by Annotation )

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

76
        /** @scrutinizer ignore-call */ Route::group([

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...
77 17
            $this->loadRoutesFrom(__DIR__.'/../routes/web.php');
78 17
        });
79 17
    }
80
81 17
    protected function loadViews()
82
    {
83 17
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'postman');
84
    }
85
}