@@ -14,7 +14,7 @@ |
||
| 14 | 14 | | |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -$factory->define(Article::class, function (Faker $faker) { |
|
| 17 | +$factory->define(Article::class, function(Faker $faker) { |
|
| 18 | 18 | return [ |
| 19 | 19 | ]; |
| 20 | 20 | }); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('asset_pivots', function (Blueprint $table) { |
|
| 16 | + Schema::create('asset_pivots', function(Blueprint $table) { |
|
| 17 | 17 | $table->integer('asset_id'); |
| 18 | 18 | $table->integer('entity_id'); |
| 19 | 19 | $table->string('entity_type'); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('assets', function (Blueprint $table) { |
|
| 16 | + Schema::create('assets', function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->timestamps(); |
| 19 | 19 | }); |
@@ -25,21 +25,21 @@ discard block |
||
| 25 | 25 | public function boot() |
| 26 | 26 | { |
| 27 | 27 | $this->publishes([ |
| 28 | - __DIR__.'/../config/thinktomorrow/assetlibrary.php' => config_path('assetlibrary.php'), |
|
| 28 | + __DIR__ . '/../config/thinktomorrow/assetlibrary.php' => config_path('assetlibrary.php'), |
|
| 29 | 29 | ], 'config'); |
| 30 | 30 | |
| 31 | 31 | // use this if your package has routes |
| 32 | 32 | $this->setupRoutes($this->app->router); |
| 33 | 33 | |
| 34 | - if (! class_exists('CreateAssetTable')) { |
|
| 34 | + if ( ! class_exists('CreateAssetTable')) { |
|
| 35 | 35 | $this->publishes([ |
| 36 | - __DIR__.'/../database/migrations/create_asset_table.php' => database_path('migrations/'.date('Y_m_d_His', |
|
| 37 | - time()).'_create_asset_table.php'), |
|
| 36 | + __DIR__ . '/../database/migrations/create_asset_table.php' => database_path('migrations/' . date('Y_m_d_His', |
|
| 37 | + time()) . '_create_asset_table.php'), |
|
| 38 | 38 | ], 'migrations'); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $this->registerModelBindings(); |
| 42 | - $this->registerEloquentFactoriesFrom(__DIR__.'/../database/factories'); |
|
| 42 | + $this->registerEloquentFactoriesFrom(__DIR__ . '/../database/factories'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public function setupRoutes(Router $router) |
| 63 | 63 | { |
| 64 | - $router->group(['namespace' => 'Thinktomorrow\AssetLibrary\Http\Controllers'], function ($router) { |
|
| 65 | - require __DIR__.'/Http/routes.php'; |
|
| 64 | + $router->group(['namespace' => 'Thinktomorrow\AssetLibrary\Http\Controllers'], function($router) { |
|
| 65 | + require __DIR__ . '/Http/routes.php'; |
|
| 66 | 66 | }); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function register() |
| 75 | 75 | { |
| 76 | - $this->mergeConfigFrom(__DIR__.'/../config/assetlibrary.php', 'assetlibrary'); |
|
| 76 | + $this->mergeConfigFrom(__DIR__ . '/../config/assetlibrary.php', 'assetlibrary'); |
|
| 77 | 77 | |
| 78 | 78 | $this->registerAssetLibrary(); |
| 79 | 79 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | private function registerAssetLibrary() |
| 94 | 94 | { |
| 95 | - $this->app->singleton('asset', function ($app) { |
|
| 95 | + $this->app->singleton('asset', function($app) { |
|
| 96 | 96 | return new Asset($app); |
| 97 | 97 | }); |
| 98 | 98 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | return; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if (! $locale) { |
|
| 34 | + if ( ! $locale) { |
|
| 35 | 35 | $locale = Locale::getDefault(); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | public function getAllImages() |
| 73 | 73 | { |
| 74 | - $images = $this->assets->filter(function ($asset) { |
|
| 74 | + $images = $this->assets->filter(function($asset) { |
|
| 75 | 75 | return $asset->getExtensionForFilter() == 'image'; |
| 76 | 76 | }); |
| 77 | 77 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | if ($files instanceof self) { |
| 30 | 30 | return $files; |
| 31 | 31 | } elseif (is_array($files)) { |
| 32 | - collect($files)->each(function ($file) use ($list) { |
|
| 32 | + collect($files)->each(function($file) use ($list) { |
|
| 33 | 33 | if ($file instanceof Asset) { |
| 34 | 34 | $list->push($file); |
| 35 | 35 | } else { |
@@ -57,16 +57,16 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function uploadToAsset($files, $keepOriginal = false) |
| 59 | 59 | { |
| 60 | - if (! ($files instanceof File) && ! ($files instanceof UploadedFile)) { |
|
| 60 | + if ( ! ($files instanceof File) && ! ($files instanceof UploadedFile)) { |
|
| 61 | 61 | return; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $customProps = []; |
| 65 | 65 | if (self::isImage($files)) { |
| 66 | - $customProps['dimensions'] = getimagesize($files)[0].' x '.getimagesize($files)[1]; |
|
| 66 | + $customProps['dimensions'] = getimagesize($files)[0] . ' x ' . getimagesize($files)[1]; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - $fileAdd = $this->addMedia($files)->withCustomProperties($customProps); |
|
| 69 | + $fileAdd = $this->addMedia($files)->withCustomProperties($customProps); |
|
| 70 | 70 | if ($keepOriginal) { |
| 71 | 71 | $fileAdd = $fileAdd->preservingOriginal(); |
| 72 | 72 | } |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | { |
| 96 | 96 | $asset = $model->assets->where('pivot.type', $type)->where('pivot.locale', $locale); |
| 97 | 97 | |
| 98 | - if (! $asset->isEmpty() && $asset->first()->pivot->type !== '') { |
|
| 98 | + if ( ! $asset->isEmpty() && $asset->first()->pivot->type !== '') { |
|
| 99 | 99 | $model->assets()->detach($asset->first()->id); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - if (! $locale) { |
|
| 102 | + if ( ! $locale) { |
|
| 103 | 103 | $locale = Locale::getDefault(); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | if ($extension === 'image') { |
| 151 | 151 | return $this->getFileUrl($type); |
| 152 | 152 | } elseif ($extension) { |
| 153 | - return asset('assets/back/img/'.$extension.'.png'); |
|
| 153 | + return asset('assets/back/img/' . $extension . '.png'); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | return asset('assets/back/img/other.png'); |
@@ -237,13 +237,13 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | public static function typeField($type = '', $locale = null, $name = 'type') |
| 239 | 239 | { |
| 240 | - $result = '<input type="hidden" value="'.$type.'" name="'; |
|
| 240 | + $result = '<input type="hidden" value="' . $type . '" name="'; |
|
| 241 | 241 | |
| 242 | - if (! $locale) { |
|
| 243 | - return $result.$name.'">'; |
|
| 242 | + if ( ! $locale) { |
|
| 243 | + return $result . $name . '">'; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - return $result.'trans['.$locale.'][files][]">'; |
|
| 246 | + return $result . 'trans[' . $locale . '][files][]">'; |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | foreach ($conversions as $key => $value) { |
| 273 | 273 | if ($conversionPrefix) { |
| 274 | - $conversionName = $media->name.'_'.$key; |
|
| 274 | + $conversionName = $media->name . '_' . $key; |
|
| 275 | 275 | } else { |
| 276 | 276 | $conversionName = $key; |
| 277 | 277 | } |