Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.x] Add support for granular messages on Dimensions rule #52707

Closed
wants to merge 22 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2a8f35f
fix(dimensions): add properties to hold constraint values
CamKem Sep 6, 2024
c39a038
fix(dimensions): update constructor to call methods
CamKem Sep 6, 2024
cb46dd6
fix(dimensions): add new constraint methods & update existing to use …
CamKem Sep 6, 2024
04aaa29
fix(dimensions): build the validation rules and methods for data & va…
CamKem Sep 6, 2024
67b8991
fix(dimensions): add granular validation message translation strings
CamKem Sep 6, 2024
fcfd82b
fix(dimensions): add replace methods for granular rules
CamKem Sep 6, 2024
18b5652
fix(dimensions): cleanup additional methods on dimensions
CamKem Sep 6, 2024
1308f47
fix(dimensions): add methods for to ValidatesAttributes for validatin…
CamKem Sep 6, 2024
3948899
test: added one for each of the methods on the dimensions rule
CamKem Sep 6, 2024
c1ea328
test: add method for string format of the rule
CamKem Sep 6, 2024
8bee70f
test: added one for macroable trait
CamKem Sep 6, 2024
7ea1e5c
test: update expected validation messages for granularity on image fi…
CamKem Sep 6, 2024
6128096
chore: cleanup obsolete constructor
CamKem Sep 7, 2024
a2d280f
fix: add properties for the between rules & building rules
CamKem Sep 7, 2024
3b719bc
fix: add default callback & custom rule merges
CamKem Sep 9, 2024
8ddc78a
fix: use existing min, max & between replacement methods
CamKem Sep 9, 2024
868bac0
fix: styleci
CamKem Sep 9, 2024
5812d03
fix: styleci
CamKem Sep 9, 2024
3809876
Merge branch 'refs/heads/11.x' into feat/granular-dimension-messages
CamKem Sep 9, 2024
320f24c
stylci
CamKem Sep 11, 2024
7d47d87
fix: merge regression
CamKem Sep 17, 2024
054b1dd
test: coverage for constraints passed into the constructor via Rule c…
CamKem Sep 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(dimensions): add new constraint methods & update existing to use …
…properties
CamKem committed Sep 6, 2024

Verified

This commit was signed with the committer’s verified signature.
navilg Navratan Lal Gupta
commit cb46dd61e75ae0bba7b267be2219e3ef38cc3021
87 changes: 79 additions & 8 deletions src/Illuminate/Validation/Rules/Dimensions.php
Original file line number Diff line number Diff line change
@@ -129,7 +129,7 @@ public function __construct(array $constraints = [])
*/
public function width($value)
{
$this->constraints['width'] = $value;
$this->width = $value;

return $this;
}
@@ -142,7 +142,7 @@ public function width($value)
*/
public function height($value)
{
$this->constraints['height'] = $value;
$this->height = $value;

return $this;
}
@@ -155,7 +155,7 @@ public function height($value)
*/
public function minWidth($value)
{
$this->constraints['min_width'] = $value;
$this->minWidth = $value;

return $this;
}
@@ -168,7 +168,7 @@ public function minWidth($value)
*/
public function minHeight($value)
{
$this->constraints['min_height'] = $value;
$this->minHeight = $value;

return $this;
}
@@ -181,7 +181,7 @@ public function minHeight($value)
*/
public function maxWidth($value)
{
$this->constraints['max_width'] = $value;
$this->maxWidth =$value;

return $this;
}
@@ -194,7 +194,37 @@ public function maxWidth($value)
*/
public function maxHeight($value)
{
$this->constraints['max_height'] = $value;
$this->maxHeight = $value;

return $this;
}

/**
* Set the width between constraint.
*
* @param int $min
* @param int $max
* @return $this
*/
public function widthBetween($min, $max)
{
$this->minWidth = $min;
$this->maxWidth = $max;

return $this;
}

/**
* Set the height between constraint.
*
* @param int $min
* @param int $max
* @return $this
*/
public function heightBetween($min, $max)
{
$this->minHeight = $min;
$this->maxHeight = $max;

return $this;
}
@@ -207,13 +237,54 @@ public function maxHeight($value)
*/
public function ratio($value)
{
$this->constraints['ratio'] = $value;
$this->ratio = $value;

return $this;
}

/**
* Set the minimum aspect ratio constraint.
*
* @param float $value
* @return $this
*/
public function minRatio($value)
{
$this->minRatio = $value;

return $this;
}

/**
* Set the maximum aspect ratio constraint.
*
* @param float $value
* @return $this
*/
public function maxRatio($value)
{
$this->maxRatio = $value;

return $this;
}

/**
* Set the aspect ratio range constraint.
*
* @param float $min
* @param float $max
* @return $this
*/
public function ratioBetween($min, $max)
{
$this->minRatio = $min;
$this->maxRatio = $max;

return $this;
}

/**
* Convert the rule to a validation string.
* Build the array of underlying validation rules based on the current state.
*
* @return string
*/