@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function byKey($key, $section = null) |
| 36 | 36 | { |
| 37 | - return $this->model->when($section, function ($query) use ($section) { |
|
| 37 | + return $this->model->when($section, function($query) use ($section) { |
|
| 38 | 38 | $query->where('section', $section); |
| 39 | 39 | })->where('key', $key)->exists() ? $this->model->where('key', $key)->with('translations')->first()->value : null; |
| 40 | 40 | } |
@@ -45,13 +45,13 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function getFormFields($section = null) |
| 47 | 47 | { |
| 48 | - $settings = $this->model->when($section, function ($query) use ($section) { |
|
| 48 | + $settings = $this->model->when($section, function($query) use ($section) { |
|
| 49 | 49 | $query->where('section', $section); |
| 50 | 50 | })->with('translations', 'medias')->get(); |
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | if (config('twill.media_library.translated_form_fields', false)) { |
| 54 | - $medias = $settings->reduce(function ($carry, $setting) { |
|
| 54 | + $medias = $settings->reduce(function($carry, $setting) { |
|
| 55 | 55 | foreach (getLocales() as $locale) { |
| 56 | 56 | if (!empty(parent::getFormFields($setting)['medias'][$locale]) && !empty(parent::getFormFields($setting)['medias'][$locale][$setting->key])) |
| 57 | 57 | { |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | return $carry; |
| 62 | 62 | }); |
| 63 | 63 | } else { |
| 64 | - $medias = $settings->mapWithKeys(function ($setting) { |
|
| 64 | + $medias = $settings->mapWithKeys(function($setting) { |
|
| 65 | 65 | return [$setting->key => parent::getFormFields($setting)['medias'][$setting->key] ?? null]; |
| 66 | 66 | })->filter()->toArray(); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - return $settings->mapWithKeys(function ($setting) { |
|
| 69 | + return $settings->mapWithKeys(function($setting) { |
|
| 70 | 70 | $settingValue = []; |
| 71 | 71 | |
| 72 | 72 | foreach ($setting->translations as $translation) { |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | if (config('twill.media_library.translated_form_fields', false)) { |
| 119 | 119 | foreach (getLocales() as $locale) { |
| 120 | - $medias["{$role}[{$locale}]"] = Collection::make($settingsFields['medias'][$role][$locale])->map(function ($media) { |
|
| 120 | + $medias["{$role}[{$locale}]"] = Collection::make($settingsFields['medias'][$role][$locale])->map(function($media) { |
|
| 121 | 121 | return json_decode($media, true); |
| 122 | 122 | })->filter()->toArray(); |
| 123 | 123 | } |
| 124 | 124 | } else { |
| 125 | - $medias = [ |
|
| 126 | - $role => Collection::make($settingsFields['medias'][$role])->map(function ($media) { |
|
| 125 | + $medias = [ |
|
| 126 | + $role => Collection::make($settingsFields['medias'][$role])->map(function($media) { |
|
| 127 | 127 | return json_decode($media, true); |
| 128 | 128 | })->values()->filter()->toArray(), |
| 129 | 129 | ]; |
@@ -23,18 +23,18 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | public function __construct(array $attributes = []) |
| 25 | 25 | { |
| 26 | - $this->fillable(array_merge($this->fillable, Collection::make(config('twill.media_library.extra_metadatas_fields'))->map(function ($field) { |
|
| 26 | + $this->fillable(array_merge($this->fillable, Collection::make(config('twill.media_library.extra_metadatas_fields'))->map(function($field) { |
|
| 27 | 27 | return $field['name']; |
| 28 | 28 | })->toArray())); |
| 29 | 29 | |
| 30 | - Collection::make(config('twill.media_library.translatable_metadatas_fields'))->each(function ($field) { |
|
| 30 | + Collection::make(config('twill.media_library.translatable_metadatas_fields'))->each(function($field) { |
|
| 31 | 31 | $this->casts[$field] = 'json'; |
| 32 | 32 | }); |
| 33 | 33 | |
| 34 | 34 | parent::__construct($attributes); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function scopeUnused ($query) |
|
| 37 | + public function scopeUnused($query) |
|
| 38 | 38 | { |
| 39 | 39 | $usedIds = DB::table(config('twill.mediables_table'))->get()->pluck('media_id'); |
| 40 | 40 | return $query->whereNotIn('id', $usedIds->toArray())->get(); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | 'medium' => ImageService::getUrl($this->uuid, ["h" => "430"]), |
| 76 | 76 | 'width' => $this->width, |
| 77 | 77 | 'height' => $this->height, |
| 78 | - 'tags' => $this->tags->map(function ($tag) { |
|
| 78 | + 'tags' => $this->tags->map(function($tag) { |
|
| 79 | 79 | return $tag->name; |
| 80 | 80 | }), |
| 81 | 81 | 'deleteUrl' => $this->canDeleteSafely() ? moduleRoute('medias', 'media-library', 'destroy', $this->id) : null, |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | 'caption' => $this->caption, |
| 88 | 88 | 'altText' => $this->alt_text, |
| 89 | 89 | 'video' => null, |
| 90 | - ] + Collection::make(config('twill.media_library.extra_metadatas_fields'))->mapWithKeys(function ($field) { |
|
| 90 | + ] + Collection::make(config('twill.media_library.extra_metadatas_fields'))->mapWithKeys(function($field) { |
|
| 91 | 91 | return [ |
| 92 | 92 | $field['name'] => $this->{$field['name']}, |
| 93 | 93 | ]; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | if ($this->update($fields) && $this->isReferenced()) |
| 144 | 144 | { |
| 145 | - DB::table(config('twill.mediables_table', 'twill_mediables'))->where('media_id', $this->id)->get()->each(function ($mediable) use ($prevWidth, $prevHeight) { |
|
| 145 | + DB::table(config('twill.mediables_table', 'twill_mediables'))->where('media_id', $this->id)->get()->each(function($mediable) use ($prevWidth, $prevHeight) { |
|
| 146 | 146 | |
| 147 | 147 | if ($prevWidth != $this->width) { |
| 148 | 148 | $mediable->crop_x = 0; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $mediable->crop_h = $this->height; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - DB::table(config('twill.mediables_table', 'twill_mediables'))->where('id', $mediable->id)->update((array)$mediable); |
|
| 157 | + DB::table(config('twill.mediables_table', 'twill_mediables'))->where('id', $mediable->id)->update((array) $mediable); |
|
| 158 | 158 | }); |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -240,8 +240,8 @@ |
||
| 240 | 240 | |
| 241 | 241 | // Title is mandatory |
| 242 | 242 | throw new Exception( |
| 243 | - "Block {$blockName} does not exists or the mandatory property '{$property}' ". |
|
| 244 | - "was not found on this block. If you are still using blocks on the twill.php ". |
|
| 243 | + "Block {$blockName} does not exists or the mandatory property '{$property}' " . |
|
| 244 | + "was not found on this block. If you are still using blocks on the twill.php " . |
|
| 245 | 245 | "file, please check if the block is present and properly configured." |
| 246 | 246 | ); |
| 247 | 247 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | if (!function_exists('dumpUsableSqlQuery')) { |
| 10 | 10 | function dumpUsableSqlQuery($query) |
| 11 | 11 | { |
| 12 | - dd(vsprintf(str_replace('?', '%s', $query->toSql()), array_map(function ($binding) { |
|
| 12 | + dd(vsprintf(str_replace('?', '%s', $query->toSql()), array_map(function($binding) { |
|
| 13 | 13 | return is_numeric($binding) ? $binding : "'{$binding}'"; |
| 14 | 14 | }, $query->getBindings()))); |
| 15 | 15 | } |
@@ -201,12 +201,12 @@ discard block |
||
| 201 | 201 | { |
| 202 | 202 | $blockList = app(BlockCollection::class)->getBlockList(); |
| 203 | 203 | |
| 204 | - $appBlocksList = $blockList->filter(function ($block) { |
|
| 204 | + $appBlocksList = $blockList->filter(function($block) { |
|
| 205 | 205 | return $block['source'] !== A17\Twill\Services\Blocks\Block::SOURCE_TWILL; |
| 206 | 206 | }); |
| 207 | 207 | |
| 208 | 208 | $finalBlockList = $blockList->filter( |
| 209 | - function ($block) use ($blocks, $groups, $appBlocksList) { |
|
| 209 | + function($block) use ($blocks, $groups, $appBlocksList) { |
|
| 210 | 210 | if ($block['group'] === A17\Twill\Services\Blocks\Block::SOURCE_TWILL) { |
| 211 | 211 | if (!collect( |
| 212 | 212 | config('twill.block_editor.use_twill_blocks') |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | if (count($appBlocksList) > 0 && $appBlocksList->contains( |
| 218 | - function ($appBlock) use ($block) { |
|
| 218 | + function($appBlock) use ($block) { |
|
| 219 | 219 | return $appBlock['name'] === $block['name']; |
| 220 | 220 | }) |
| 221 | 221 | ) { |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | |
| 44 | 44 | $this->call('twill:make:module', [ |
| 45 | 45 | 'moduleName' => $this->argument('moduleName'), |
| 46 | - ] + $options->mapWithKeys(function ($value, $key) { |
|
| 46 | + ] + $options->mapWithKeys(function($value, $key) { |
|
| 47 | 47 | return ["--{$key}" => $value]; |
| 48 | 48 | })->toArray()); |
| 49 | 49 | } |