1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace DavideCasiraghi\PhpResponsiveRandomQuote; |
4
|
|
|
|
5
|
|
|
use Carbon\Carbon; |
6
|
|
|
use Illuminate\Support\Facades\Route; |
7
|
|
|
use Illuminate\Support\ServiceProvider; |
8
|
|
|
use DavideCasiraghi\PhpResponsiveRandomQuote\Console\ResponsiveQuote; |
9
|
|
|
use DavideCasiraghi\PhpResponsiveRandomQuote\Http\Controllers\ResponsiveQuoteController; |
10
|
|
|
|
11
|
|
|
class PhpResponsiveRandomQuoteServiceProvider extends ServiceProvider |
12
|
|
|
{ |
13
|
15 |
|
public function boot() |
14
|
|
|
{ |
15
|
15 |
|
if ($this->app->runningInConsole()) { |
16
|
15 |
|
$this->commands([ |
17
|
15 |
|
ResponsiveQuote::class, //the console class |
18
|
|
|
]); |
19
|
|
|
} |
20
|
|
|
|
21
|
15 |
|
$this->loadViewsFrom(__DIR__.'/../resources/views', 'php-responsive-quote'); |
22
|
15 |
|
$this->loadRoutesFrom(__DIR__.'/../routes/web.php'); |
23
|
|
|
|
24
|
15 |
|
$this->publishes([ |
25
|
15 |
|
__DIR__.'/../resources/views' => resource_path('views/vendor/responsive-quotes/'), |
26
|
15 |
|
], 'views'); |
27
|
|
|
|
28
|
15 |
|
$this->publishes([ |
29
|
15 |
|
__DIR__.'/../config/random-quote.php' => base_path('config/random-quote.php'), |
30
|
15 |
|
], 'config'); |
31
|
|
|
|
32
|
15 |
|
$this->publishes([ |
33
|
15 |
|
__DIR__.'/../resources/assets/images' => public_path('vendor/responsive-quotes/assets/images/'), |
34
|
15 |
|
], 'images'); |
35
|
|
|
|
36
|
15 |
|
$this->publishes([ |
37
|
15 |
|
__DIR__.'/../resources/assets/sass' => resource_path('sass/vendor/responsive-quotes/'), |
38
|
15 |
|
], 'sass'); |
39
|
|
|
|
40
|
15 |
|
if (! class_exists('CreateQuotesTable')) { |
41
|
1 |
|
$this->publishes([ |
42
|
1 |
|
__DIR__.'/../database/migrations/create_quotes_table.php.stub' => database_path('migrations/'.Carbon::now()->format('Y_m_d_Hmsu').'_create_quotes_table.php'), |
43
|
1 |
|
], 'migrations'); |
44
|
|
|
} |
45
|
|
|
|
46
|
15 |
|
if (! class_exists('CreateQuoteTranslationsTable')) { |
47
|
1 |
|
$this->publishes([ |
48
|
1 |
|
__DIR__.'/../database/migrations/create_quote_translations_table.php.stub' => database_path('migrations/'.Carbon::now()->format('Y_m_d_Hmsu').'_create_quote_translations_table.php'), |
49
|
1 |
|
], 'migrations'); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
//Route::get(config('random-quote.route'), ResponsiveQuoteController::class); |
53
|
|
|
/*Route::group(['middleware' => 'web'], function () { |
54
|
|
|
Route::resource('php-responsive-quote', ResponsiveQuoteController::class); |
55
|
|
|
|
56
|
|
|
//Route::get('/php-responsive-quote/random-quote/')->uses('App\Http\Controllers\ResponsiveQuoteController@showRandomQuote'); |
57
|
|
|
Route::get('/php-responsive-quote/random-quote/', ResponsiveQuoteController::class); |
58
|
|
|
//Route::get('random-quote', ResponsiveQuoteController::class); |
59
|
|
|
});*/ |
60
|
15 |
|
} |
61
|
|
|
|
62
|
15 |
|
public function register() |
63
|
|
|
{ |
64
|
|
|
$this->app->bind('php-responsive-quote', function () { |
65
|
2 |
|
return new QuoteFactory(); |
66
|
15 |
|
}); |
67
|
|
|
|
68
|
15 |
|
$this->mergeConfigFrom(__DIR__.'/../config/random-quote.php', 'random-quote'); |
69
|
15 |
|
} |
70
|
|
|
} |
71
|
|
|
|