@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('files', function (Blueprint $table) { |
|
16 | + Schema::create('files', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->string('name'); |
19 | 19 | $table->string('path'); |
@@ -13,8 +13,8 @@ |
||
13 | 13 | |
14 | 14 | public static function bootWithImages(): void |
15 | 15 | { |
16 | - static::deleted(function ($model) { |
|
17 | - $model->images->each(function ($image) { |
|
16 | + static::deleted(function($model) { |
|
17 | + $model->images->each(function($image) { |
|
18 | 18 | $image->delete(); |
19 | 19 | }); |
20 | 20 | }); |
@@ -12,8 +12,8 @@ |
||
12 | 12 | |
13 | 13 | public static function bootWithFiles(): void |
14 | 14 | { |
15 | - static::deleted(function ($model) { |
|
16 | - $model->files->each(function ($file) { |
|
15 | + static::deleted(function($model) { |
|
16 | + $model->files->each(function($file) { |
|
17 | 17 | $file->delete(); |
18 | 18 | }); |
19 | 19 | }); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | { |
8 | 8 | public static function route($enable = ['store', 'delete'], callable $callback = null): void |
9 | 9 | { |
10 | - Route::prefix('files')->group(function () use ($enable, $callback) { |
|
10 | + Route::prefix('files')->group(function() use ($enable, $callback) { |
|
11 | 11 | $namespace = '\\UniSharp\\Uploadable\\Http\\Controllers\\Api\\V1\\'; |
12 | 12 | |
13 | 13 | if (in_array('store', $enable)) { |
@@ -30,7 +30,7 @@ |
||
30 | 30 | '.' . |
31 | 31 | $image->extension; |
32 | 32 | |
33 | - $image->resize($width, $height, function ($constraint) { |
|
33 | + $image->resize($width, $height, function($constraint) { |
|
34 | 34 | $constraint->aspectRatio(); |
35 | 35 | $constraint->upsize(); |
36 | 36 | })->save($filename, 100); |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | public function getThumbAttribute(): array |
14 | 14 | { |
15 | - return collect(['s', 'm', 'l'])->flip()->map(function ($_, $size) { |
|
15 | + return collect(['s', 'm', 'l'])->flip()->map(function($_, $size) { |
|
16 | 16 | return URL::to(preg_replace('/^(images\/)/', "\$1{$size}/", $this->attributes['path'])); |
17 | 17 | })->toArray(); |
18 | 18 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | { |
17 | 17 | parent::boot(); |
18 | 18 | |
19 | - static::deleted(function ($model) { |
|
19 | + static::deleted(function($model) { |
|
20 | 20 | Storage::delete($model->attributes['path']); |
21 | 21 | }); |
22 | 22 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | $images = $this->getImages($origin_image); |
15 | 15 | |
16 | - collect($images)->each(function ($image) use ($storage) { |
|
16 | + collect($images)->each(function($image) use ($storage) { |
|
17 | 17 | if (in_array($image->mime(), $this->supportedMime)) { |
18 | 18 | $watermark = $this->getWatermark($image); |
19 | 19 | $image->insert($watermark, 'bottom-right'); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | $thumbs = array_keys(Config::get('uploadable.thumbs')); |
30 | 30 | |
31 | - collect($thumbs)->each(function ($size) use (&$images, $image) { |
|
31 | + collect($thumbs)->each(function($size) use (&$images, $image) { |
|
32 | 32 | $path = $this->getDirectory($image->dirname, $size) . $image->filename . '.' . $image->extension; |
33 | 33 | |
34 | 34 | if (file_exists($path)) { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $watermark = Image::make(storage_path('app' . DIRECTORY_SEPARATOR . 'watermark.png')); |
45 | 45 | |
46 | - $watermark->resize($image->getWidth() / 2.5, null, function ($constraint) { |
|
46 | + $watermark->resize($image->getWidth() / 2.5, null, function($constraint) { |
|
47 | 47 | $constraint->aspectRatio(); |
48 | 48 | $constraint->upsize(); |
49 | 49 | }); |