1 | <?php |
||||
2 | |||||
3 | namespace Mostafaznv\Larupload; |
||||
4 | |||||
5 | use Illuminate\Database\Schema\Blueprint as BlueprintIlluminate; |
||||
6 | use Illuminate\Support\ServiceProvider; |
||||
7 | use Mostafaznv\Larupload\Database\Schema\Blueprint; |
||||
8 | use Mostafaznv\Larupload\Enums\LaruploadMode; |
||||
9 | |||||
10 | class LaruploadServiceProvider extends ServiceProvider |
||||
11 | { |
||||
12 | // TODO - throw a custom exception when ffmpeg queue exceeds the limit |
||||
13 | // TODO - remove meta-data from file |
||||
14 | |||||
15 | public function boot(): void |
||||
16 | { |
||||
17 | $this->loadTranslationsFrom(__DIR__ . '/../translations', 'larupload'); |
||||
18 | |||||
19 | if ($this->app->runningInConsole()) { |
||||
20 | $this->publishes([__DIR__ . '/../config/config.php' => config_path('larupload.php')], 'config'); |
||||
21 | $this->publishes([__DIR__ . '/../migrations/' => database_path('migrations')], 'migrations'); |
||||
22 | $this->publishes([__DIR__ . '/../translations/' => lang_path('vendor/larupload')]); |
||||
23 | } |
||||
24 | } |
||||
25 | |||||
26 | public function register(): void |
||||
27 | { |
||||
28 | $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'larupload'); |
||||
29 | |||||
30 | $this->registerMacros(); |
||||
31 | } |
||||
32 | |||||
33 | protected function registerMacros(): void |
||||
34 | { |
||||
35 | BlueprintIlluminate::macro('upload', function(string $name, LaruploadMode $mode = LaruploadMode::HEAVY) { |
||||
36 | Blueprint::columns($this, $name, $mode); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
37 | }); |
||||
38 | |||||
39 | BlueprintIlluminate::macro('dropUpload', function(string $name, LaruploadMode $mode = LaruploadMode::HEAVY) { |
||||
40 | Blueprint::dropColumns($this, $name, $mode); |
||||
0 ignored issues
–
show
$this of type Mostafaznv\Larupload\LaruploadServiceProvider is incompatible with the type Illuminate\Database\Schema\Blueprint expected by parameter $table of Mostafaznv\Larupload\Dat...lueprint::dropColumns() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
41 | }); |
||||
42 | |||||
43 | BlueprintIlluminate::macro('laruploadAddOriginalName', function(string $name) { |
||||
44 | Blueprint::addOriginalName($this, $name); |
||||
0 ignored issues
–
show
$this of type Mostafaznv\Larupload\LaruploadServiceProvider is incompatible with the type Illuminate\Database\Schema\Blueprint expected by parameter $table of Mostafaznv\Larupload\Dat...rint::addOriginalName() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
45 | }); |
||||
46 | } |
||||
47 | } |
||||
48 |