Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
[ci skip] [skip ci]
  • Loading branch information
StyleCIBot authored and pxpm committed Apr 17, 2024
1 parent 5bd2b65 commit bf48007
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
5 changes: 3 additions & 2 deletions src/app/Library/CrudPanel/CrudColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,11 @@ private function save()
public function __call($method, $parameters)
{
if (static::hasMacro($method)) {
if(in_array($method, ['withFiles', 'withMedia'])) {
if (in_array($method, ['withFiles', 'withMedia'])) {
$this->setAttributeValue($method, $parameters[0] ?? true);
$this->save();
}
}

return $this->macroCall($method, $parameters);
}

Expand Down
5 changes: 3 additions & 2 deletions src/app/Library/CrudPanel/CrudField.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,11 @@ public function dd()
public function __call($method, $parameters)
{
if (static::hasMacro($method)) {
if(in_array($method, ['withFiles', 'withMedia'])) {
if (in_array($method, ['withFiles', 'withMedia'])) {
$this->setAttributeValue($method, $parameters[0] ?? true);
$this->save();
}
}

return $this->macroCall($method, $parameters);
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/Library/Uploaders/Support/UploadersRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
use Backpack\CRUD\app\Library\Uploaders\Support\Interfaces\UploaderInterface;
use Illuminate\Support\Str;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;

final class UploadersRepository
{
Expand Down Expand Up @@ -152,7 +152,7 @@ public function getFieldUploaderInstance(string $requestInputName): UploaderInte
$uploader = Arr::first($uploaders, function ($uploader) use ($requestInputName) {
return $uploader->getName() === $requestInputName;
});

if (! $uploader) {
abort(500, 'Could not find the field in the repeatable uploaders.');
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/Library/Validation/Rules/BackpackCustomRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function validateFieldRules(string $attribute, null|array|string|Uploaded
$data = $data ?? $this->data;
$validationRuleAttribute = $this->getValidationAttributeString($attribute);
$data = $this->prepareValidatorData($data, $attribute);

return $this->validateAndGetErrors($validationRuleAttribute, $data, $customRules ?? $this->getFieldRules());
}

Expand Down
1 change: 0 additions & 1 deletion src/app/Library/Validation/Rules/ValidUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Backpack\CRUD\app\Library\Validation\Rules;

use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade;
use Backpack\CRUD\app\Library\Validation\Rules\Support\HasFiles;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Support\Arr;
Expand Down
4 changes: 1 addition & 3 deletions src/app/Library/Validation/Rules/ValidUploadMultiple.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
namespace Backpack\CRUD\app\Library\Validation\Rules;

use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade;
use Backpack\CRUD\app\Library\Validation\Rules\Support\HasFiles;
use Backpack\CRUD\app\Library\Validation\Rules\Support\ValidateArrayContract;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Backpack\CRUD\app\Library\Validation\Rules\BackpackCustomRule;

class ValidUploadMultiple extends BackpackCustomRule implements ValidateArrayContract
{
Expand Down Expand Up @@ -35,7 +33,7 @@ public function validateRules(string $attribute, mixed $value): array
if ($entry) {
$filesDeleted = CrudPanelFacade::getRequest()->input('clear_'.$attribute) ?? [];
Arr::set($data, $attribute, array_diff(Arr::get($data, $attribute), $filesDeleted));

return $this->validateFieldAndFile($attribute, $data);
}

Expand Down

0 comments on commit bf48007

Please sign in to comment.