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
|
|
|
Console\AssetsConsole::class, |
33
|
|
|
]); |
34
|
17 |
|
$this->loadViews(); |
35
|
|
|
|
36
|
17 |
|
Request::macro('datePostman', function (Request $request) { |
37
|
2 |
|
$request-> date = Carbon::parse($request->date)->toDateTimeString(); |
|
|
|
|
38
|
17 |
|
}); |
39
|
17 |
|
$this->mergeConfigFrom(__DIR__.'/../config/postman.php', 'postman'); |
40
|
17 |
|
$this->publishesAll(); |
41
|
17 |
|
} |
42
|
|
|
|
43
|
17 |
|
public function register() |
44
|
|
|
{ |
45
|
17 |
|
if (! defined('POSTMAN_PATH')) { |
46
|
3 |
|
define('POSTMAN_PATH', realpath(__DIR__.'/../')); |
47
|
|
|
} |
48
|
17 |
|
} |
49
|
17 |
|
public function publishesAll() : void |
50
|
|
|
{ |
51
|
17 |
|
$this->publishes([ |
52
|
17 |
|
__DIR__.'/../database/migrations' => database_path('migrations'), |
53
|
17 |
|
], 'postman-migration'); |
54
|
|
|
|
55
|
17 |
|
$this->publishes([ |
56
|
17 |
|
__DIR__.'/../config/postman.php' => config_path('postman.php'), |
57
|
17 |
|
], 'postman-migration'); |
58
|
|
|
|
59
|
17 |
|
$this->publishes([ |
60
|
17 |
|
__DIR__.'/../resources/lang' => resource_path('lang/vendor/postman'), |
61
|
17 |
|
], 'postman-migration'); |
62
|
17 |
|
$this->publishes([ |
63
|
17 |
|
POSTMAN_PATH.'/public' => public_path('vendor/postman'), |
64
|
17 |
|
], 'postman-assets'); |
65
|
|
|
|
66
|
17 |
|
$this->publishes([ |
67
|
17 |
|
__DIR__.'/../database/seeds' => database_path('seeds'), |
68
|
17 |
|
], 'postman-migration'); |
69
|
|
|
|
70
|
17 |
|
$this->publishes([ |
71
|
17 |
|
__DIR__.'/../resources/assets/js/components' => base_path('resources/assets/js/components/postman'), |
72
|
17 |
|
], 'postman-components'); |
73
|
17 |
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Register the postman routes. |
77
|
|
|
* |
78
|
|
|
* @return void |
79
|
|
|
*/ |
80
|
17 |
|
protected function registerRoutes() |
81
|
|
|
{ |
82
|
17 |
|
Route::group([ |
83
|
17 |
|
'prefix' => 'postman', |
84
|
|
|
'namespace' => 'agoalofalife\postman\Http\Controllers', |
85
|
|
|
'middleware' => 'web', |
86
|
17 |
|
], function () { |
|
|
|
|
87
|
17 |
|
$this->loadRoutesFrom(__DIR__.'/../routes/web.php'); |
88
|
17 |
|
}); |
89
|
17 |
|
} |
90
|
|
|
|
91
|
17 |
|
protected function loadViews() |
92
|
|
|
{ |
93
|
17 |
|
$this->loadViewsFrom(__DIR__.'/../resources/views', 'postman'); |
94
|
|
|
} |
95
|
|
|
} |