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(); |
|
|
|
|
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 () { |
|
|
|
|
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
|
|
|
} |