🔧 Utilise l'id plutôt que le nom
Comme ça, s'il change, on est safe
This commit is contained in:
parent
cc27b189b1
commit
be5336fc13
11
app/Deal.php
11
app/Deal.php
@ -91,6 +91,17 @@ class Deal
|
|||||||
return $this->data['price'];
|
return $this->data['price'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getIdCategory(): int
|
||||||
|
{
|
||||||
|
return (int) $this->data['category'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function getCategory(): string
|
public function getCategory(): string
|
||||||
{
|
{
|
||||||
return Categories::$categories[$this->data['category']];
|
return Categories::$categories[$this->data['category']];
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<select id="category" name="category">
|
<select id="category" name="category">
|
||||||
<option value="">−</option>
|
<option value="">−</option>
|
||||||
@foreach(\Shikiryu\LBCReposter\Categories::$categories as $id => $category)
|
@foreach(\Shikiryu\LBCReposter\Categories::$categories as $id => $category)
|
||||||
<<option value="{{ $id }}" @if( $deal->getCategory() === $category ) selected="selected" @endif>{{ $category }}</option>
|
<<option value="{{ $id }}" @if( $deal->getIdCategory() === $id ) selected="selected" @endif>{{ $category }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select><br>
|
</select><br>
|
||||||
<input type="submit" value="Modifier" />
|
<input type="submit" value="Modifier" />
|
||||||
|
Loading…
Reference in New Issue
Block a user